HZGN.COM
welcome to my space
X
Welcome to:hzgn.com
Search:  
 HOME   Simple Menu Builder
Simple Menu Builder
Published by: admin 2009-01-07
I ran into a situation where I have to repeat creating menus from dataStore, so I created this little helper class. Hope its useful to others too :D


MenuBuilder = {
buildMenu: function(config) {
var menu = new Ext.menu.Menu();
var dataStore = config.dataStore;
dataStore.addListener('load',function() {
this.loadMenu(config,menu);
Menu Software Downloads, Reviews: Aston2 Menu, Flash Vista Style ::
Flash Vista Style Slide Menu Builder is a Flash-producing design tool for creating rich templates and easy publishing makes the menu creation simple.
http://www.fileguru.com/downloads/menu
HOME
},this);

if(config.load) {
dataStore.load();
}else {
this.loadMenu(config,menu);
Javascript Menu: dhtmlxMenu :: Cross-browser JavaScriptMenu ::
Javascript Menu Builder is a powerful Javascript-producing design tool for creating JSMenu is a simple Javascript menu that can be used on any site.
http://www.vclcomponents.com/catalog/Javascript_Menu
HOME
}

return menu;
},
loadMenu: function(config,menu) {
menu.removeAll();
nameField = config.nameField;
handler = config.handler;
config.dataStore.each(function(item){
menu.addItem(new Ext.menu.Item({
text: item.get(nameField),
handler:function() {
handler(item);
}
}));
});
}
}

three options for config:
dataStore: the data Store
nameField: the name of the store field to be put as menu item
handler: call on each item function pass the item clicked on

use it

newTicketMenu = MenuBuilder.buildMenu({
dataStore:this.myDataStore,
handler: function(item) {
someFunction({name:item.get('name'),id:item.get('i d')});
},
nameField:'name',
load:true
});

possible extension:

a config option called functionField(item)
to create a custom MenuItem's text base on the item of the dataStore


Red Hat's Rough Recovery From CFO Exit
Windows Live Finds a New, Pre-installed Home
You are looking at:hzgn.com's Simple Menu Builder, click hzgn.com to home
#If you have any other info about this subject , Please add it free.#
Your name:
E-mail:
Telphone:

Your comments:


If you have any other info about Simple Menu Builder , Please add it free.
 
 Homepage | Add to favorites | Contact us | Exchange links | LOGIN | Site map | 
Copyright© 2008 hzgn.com        Site made:CFZ