lukasz_b
4 Jan 2011, 3:33 AM
All,
I have a problem with NestedList component which reads data from a remote URL using TreeStore.
I created model:
Ext.regModel('ListItem', {
fields: [{ name: 'text', type: 'string' }, { name: 'menuItemId', type: 'int' }, { name: 'leaf', type: 'bool'}],
hasMany: { model: 'ListItem', name: 'items' }
});
which is a model which is generated and returned from my backend (url-based proxy).
My TreeStore definition looks like this:
this.store = new Ext.data.TreeStore({
model: 'ListItem',
idProperty: 'menuItemId',
proxy:
{
type: 'ajax',
url: 'MobileDashboard/MenuItems?periodId=4'
}
});
the nested list component is generated, but only top-level items are displayed (all items in all sub-menus are returned) - can we change treestore or nestedlist to parse the complete JSON response and generate complete tree instead just the top-level menu?
I also noticed that when I tap each menu item, a new request is fired, with node parameter always set to empty string: "node=". Maybe if I could get the node thing working I could rewrite by backend code to return only sub-menus (but to be perfectly honest, I'm more interested in sending the complete ListItems only once - see my question above).
thanks,
Łukasz
I have a problem with NestedList component which reads data from a remote URL using TreeStore.
I created model:
Ext.regModel('ListItem', {
fields: [{ name: 'text', type: 'string' }, { name: 'menuItemId', type: 'int' }, { name: 'leaf', type: 'bool'}],
hasMany: { model: 'ListItem', name: 'items' }
});
which is a model which is generated and returned from my backend (url-based proxy).
My TreeStore definition looks like this:
this.store = new Ext.data.TreeStore({
model: 'ListItem',
idProperty: 'menuItemId',
proxy:
{
type: 'ajax',
url: 'MobileDashboard/MenuItems?periodId=4'
}
});
the nested list component is generated, but only top-level items are displayed (all items in all sub-menus are returned) - can we change treestore or nestedlist to parse the complete JSON response and generate complete tree instead just the top-level menu?
I also noticed that when I tap each menu item, a new request is fired, with node parameter always set to empty string: "node=". Maybe if I could get the node thing working I could rewrite by backend code to return only sub-menus (but to be perfectly honest, I'm more interested in sending the complete ListItems only once - see my question above).
thanks,
Łukasz