Closed tranlamnhatnam closed 9 years ago
Resolved with jquery ui datepicker
Did you solve that by re-initializing datepicker after creating clone?
I have the same issue, and tried to re-initializing the datepicker, but its not working:
.on('before_clone.cloneya', function(event, toClone)
{
toClone.find('select, .autocomplete').select2('destroy');
toClone.find('.date').datepicker('remove');
})
.on('after_append.cloneya', function(event, toClone, newClone)
{
Helper.Select2( toClone.find('select') );
Helper.Datepicker( toClone.find('.date') );
Helper.Select2( newClone.find('select') );
Helper.Datepicker( newClone.find('.date') );
});
I am using the bootstrap-datepicker: https://bootstrap-datepicker.readthedocs.org/en/latest/
Found a solution:
.on('before_clone.cloneya', function(event, toClone)
{
toClone.find('select, .autocomplete').each(function()
{
$(this).select2('destroy');
});
toClone.find('.date').each(function()
{
$(this).datepicker('remove');
});
})
Someone has a solution with chosen plugin ?
I am sure it will work if you properly reinit the your external plugin on before_clone.cloneya, If you create the jsfiddle, then it will be easy to help you!
Found it ;)
.on('before_clone.cloneya', function(event, toClone)
{
toClone.find('select').each(function()
{
$(this).chosen('destroy');
});
})
.on('after_clone.cloneya', function (event, toClone, newclone) {
toClone.find('select').each(function()
{
$(this).chosen();
});
})
.on('after_append.cloneya', function (event, toClone, newclone) {
newclone.find('select').each(function()
{
$(this).chosen();
});
I use Cloneya with Bootstrap-datetime-picker but when clone new row datetime-picker work with only one input of row has been clone.
This is code in jsbin