EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: korenanzo on October 24, 2016, 12:10:08 AM



Title: spinning the spinner
Post by: korenanzo on October 24, 2016, 12:10:08 AM
Hi,

I need to do some things  when the user clicks the arrows of a nummberspinner, before incrementing/decrementing the spin.

I can set the spin() function, but into it I should call the actual function that do the increase of the spinner. How can I do it?

Thanks,
RIc


Title: Re: spinning the spinner
Post by: stworthy on October 24, 2016, 01:25:29 AM
Please try this code to add the 'onBeforeSpin' event to the numberspinner plugin.

Code:
<script type="text/javascript">
(function($){
var spin = $.fn.numberspinner.defaults.spin;
$.extend($.fn.numberspinner.defaults, {
spin: function(down){
var opts = $(this).numberspinner('options');
if (opts.onBeforeSpin){
opts.onBeforeSpin.call(this, down);
}
spin.call(this, down);
}
});
})(jQuery);
</script>