mirror of
https://github.com/jquery/jquery-ui.git
synced 2026-04-20 03:02:41 -04:00
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:
@@ -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">»</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">»</a>',
|
||||
items: itemList
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user