]> source.dussan.org Git - jquery-ui.git/commitdiff
Spinner: implemented init callback via trigger (thanks Scott González)
authorCa-Phun Ung <pazu2k@gmail.com>
Mon, 22 Sep 2008 11:22:14 +0000 (11:22 +0000)
committerCa-Phun Ung <pazu2k@gmail.com>
Mon, 22 Sep 2008 11:22:14 +0000 (11:22 +0000)
tests/visual/spinner.html
ui/ui.spinner.js

index f5b441e26fff58010a6e633ee2721711c79cea07..c3f12ad2957d193170de9027a61ee8c79de4e448 100644 (file)
@@ -36,7 +36,7 @@ $(function(){
                        // Two methods of adding external items to the spinner
                        //
                        // method 1: on initalisation call the add method directly and format html manually
-                       init: function(ui) {
+                       init: function(e, ui) {
                                for (var i=0; i<itemList.length; i++) {
                                        ui.add('<a href="'+ itemList[i].url +'" target="_blank">'+ itemList[i].title +'</a>');
                                }
index 572611b5d04e9cf28cecc52ba30ea0addba1138b..94e2e00f2446903665d870b8bb863e59223e0cd3 100644 (file)
@@ -18,9 +18,7 @@ $.widget('ui.spinner', {
                if($.data(this.element[0], 'spinner')) return;
                
                // check for Init callback
-               if (this.options.init) {
-                       this.options.init(this.ui(null));
-               }
+               this._trigger('init', null, this.ui(null));
                
                // perform data bind on generic objects
                if (typeof this.options.items[0] == 'object' && !this.element.is('input')) {