Title: Clone timespinnner control?
Post by: Tomas on July 26, 2020, 07:31:31 PM
Hi,
How would one clone a timespinner control? I tried to follow the other clone example but couldn't get methods to execute.
Thanks, Tomas
Title: Re: Clone timespinnner control?
Post by: jarry on July 26, 2020, 11:46:17 PM
This is the extended method 'cloneFrom' for timespinner component. (function($){ $.extend($.fn.spinner.methods, { cloneFrom: function(jq, from){ return jq.each(function(){ $(this).textbox('cloneFrom', from); $.data(this, 'spinner', { options: $.extend(true, {clone:true}, $(from).spinner('options')) }); $(this).addClass('spinner-f').attr('spinnerName', $(this).attr('textboxName')); }); } }); $.extend($.fn.timespinner.methods, { cloneFrom: function(jq, from){ return jq.each(function(){ $(this).spinner('cloneFrom', from); $.data(this, 'timespinner', { options: $.extend(true, {clone:true}, $(from).timespinner('options')) }); $(this).addClass('timespinner-f').attr('timespinnerName', $(this).attr('spinnerName')); }); } }); })(jQuery);
Usage example: $('#t1').timespinner('cloneFrom', '#t')
|