Spinner: implemented init callback via trigger (thanks Scott González)

This commit is contained in:
Ca-Phun Ung 2008-09-22 11:22:14 +00:00
parent dcb341e7f8
commit b6ad959811
2 changed files with 2 additions and 4 deletions

View 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>');
}

View 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')) {