PDA

View Full Version : Obligation to write store - model - function in same file?!



myput
20 Sep 2011, 7:54 AM
Hello,

I have a problem with nestedList.
I have my file: NavigationList who contain my NastedList in this view
It's ok it work but it's really dirty to have models, store and functions in the same file. I would like in a file stores, my store, in models my models and in my view, the function nestedList.
I tried that and use the good paths, like the tutorial, but nothing work when i'am not in the same file.

I put my view:


Ext.regModel('ListItem', {
fields: [
{name: 'text', type: 'string'},
{name: 'info', type: 'string'},
{name: 'model', type: 'string'},
{name: 'items', type: 'auto'},
{name: 'duration', type: 'auto'},
]
});


var store = new Ext.data.TreeStore({
model: 'ListItem',
proxy: {
type: 'ajax',
url: 'http://localhost:8888/WPApp/data/tracks.json',
reader: {
type: 'tree',
root: 'items'
}
},
autoload: true,
});


var nestedList = new Ext.NestedList({
title: 'Navigation',
store: store,
});


WPApp.views.NavigationListView = Ext.extend(Ext.Panel, {
title: 'Navigation',
iconCls: 'home',
layout: "card",
items: [nestedList],
initComponent: function() {
WPApp.views.NavigationListView.superclass.initComponent.call(this);
},
});


Ext.reg('NavigationListView', WPApp.views.NavigationListView);


And i don't understand, if i call the
Ext.regModel('ListItem') in other file, it's the same usually no?
and i did that:


WPApp.stores.NavigationListStore = new Ext.data.TreeStore({ model: 'ListItem', proxy: { type: 'ajax', url: 'http://localhost:8888/WPApp/data/tracks.json', reader: { type: 'tree', root: 'items' } }, autoload: true,});
and call by store:
WPApp.stores.NavigationListStore, in my View ...


But nothing .... White Page :((

Can you help me please? what i must to do for put the functions in others file ?

thanks for help :)