Spinner: new options: format, items & decimals (r728).

items: accepts a array of objects which will be converted to a list of items by the spinner.

format: printf style formatting of each item - accepts named arguments.
This commit is contained in:
Ca-Phun Ung
2008-09-20 19:04:01 +00:00
parent 77cea8f364
commit dcb341e7f8
2 changed files with 44 additions and 4 deletions

View File

@@ -32,11 +32,19 @@ $(function(){
's3': {currency: '$'},
's4': {},
's5': {
//
// 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) {
for (var i=0; i<itemList.length; i++) {
ui.add(itemList[i].title +' <a href="'+ itemList[i].url +'" target="_blank">&raquo;</a>');
ui.add('<a href="'+ itemList[i].url +'" target="_blank">'+ itemList[i].title +'</a>');
}
}
},
// method 2: use the format and items options in combination
format: '%(title) <a href="%(url)" target="_blank">&raquo;</a>',
items: itemList
}
};