PDA

View Full Version : loading tbbuttons from database via json



luka.suzberic
14 Sep 2010, 3:04 PM
HI,
first time i probably formulated question the wrong way.
I'm trying to load menu items from database:
i'm calling them via php into json store

var menuDef = new Ext.data.Store({
reader: new Ext.data.JsonReader({
fields: ['menu'],
root: 'rows'
}),
proxy: new Ext.data.HttpProxy({
url: 'php/menuload.php'
})
});
menuDef.load();
and get response like this
{rows:"{text:'something', handler:'onItemClick'},{text:'Others', handler:'onItemClick'}"}

but when i try to load them, i fail(it would be awfull to write all things i tried). my code is simple tbar:

var tool_bar =
new Ext.Toolbar({

items: [{
xtype:'tbbutton',
text:'something'
//here is the place where i want to load code like: menu:{text:'something', handler:'onItemClick'}, //{text:'Others', handler:'onItemClick'}

},{xtype:'tbspacer'},{
xtype: 'datefield',
width: 115,
iconCls: 'no-icon',
format: 'd/m/y',
disabledDays:[0,2,3,4,5,6]
}
]
});
any help would meen a lot and i woul be werry greatfull

thank you all in advance