PDA

View Full Version : Store based Menus



larowlan
15 Jun 2008, 5:05 PM
Ext.ux.RemoteMenu is a menu that add some new config options to menu items namely
store
staticItems
labelField
loadingText
itemIcon/iconField and
clickHandlerThe menu initially renders with the default loading animated gif and the passed loadingText.
When the menu is shown the store loads and the items are added from the store.
When the menu item is clicked the clickHandler is called with one argument, the record from the store corresponding with the clicked item.

Some of this is based on the excellent list filter in the grid filter plugin.

Download from http://www.rowlands-bcs.com/files/RemoteMenu.js.txt.

More documentation can be found at http://www.rowlands-bcs.com/?q=node/24

Example below.

newJobMenu = new Ext.ux.RemoteMenu({
text:'New Job',
icon: '/images/icons/color_wheel_add.png',
itemIcon: '/images/icons/color_wheel_add.png',
cls: 'x-btn-text-icon',
hideOnClick:false,
labelField: 'description',
clickHandler: function(r){
newJob(r.data.id, r.data.description);
},
store: new Ext.data.JsonStore({
sortInfo :{field:'id', direction:'ASC'},
url : '../action/str-job-type.php',
reader : new Ext.data.JsonReader(),
baseParams: {
filters: true,
where_is_stock: 1
}
}),
staticItems:['-',{
text:'Others...',
icon: '/images/icons/color_wheel_add.png',
cls: 'x-btn-text-icon',
handler: function(){
chooseJobType.show()
}
}]