PDA

View Full Version : problem console backButton of the nestedList



myput
30 Nov 2011, 8:55 AM
Hello,

I have a strange Error message in the console for my nestedlist.
My nestedlist is a panel of a main tabPanel (viewport)
When i change of panel in my tabPanel i reset the nestedlist with:


while (App.views.NestedList.items.indexOf(App.views.NestedList.getActiveItem()) > 0) {
App.views.NestedList.onBackTap();
}

The application work fine, this code works but i have an error in the console i don't know how to patch:


TypeError: 'null' is not an object (evaluating 'this.store.indexOf')

The error coming when i'm in the detailCard of the nestedList ( i have after some panels with list etc ...)

Do you know what is it and how to patch it please ?

mitchellsimoens
30 Nov 2011, 11:33 AM
Is App.views.NestedList the instance or the class definition? It must be the instance.

myput
1 Dec 2011, 5:25 AM
No, that's the problem, but i can't do it like instance.
my nestedlist is called by:

App.views.DirectoryPanel is an item of a tabPanel (viewport)


App.views.DirectoryPanel = Ext.extend(Ext.Panel, {
listeners:{
beforeactivate : function(panel) {
panel.add(App.views.DirectoryNestedList);
Ext.dispatch({
controller: App.controllers.Directory,
action: 'backtoIndex',
});
},
}
});

and the nestedlist is:

App.views.DirectoryNestedList = new Ext.NestedList({ });

and the back to index is the function who reset the nestedlist:


while (App.views.DirectoryNestedList.items.indexOf(App.views.DirectoryNestedList.getActiveItem()) > 0) {
App.views.DirectoryNestedList.onBackTap();
}

I can' t create an instance with App.views.directoryNestedList = new App.views.DirectoryNestedList();
because that makes me so many bugs with the tabPanel....

Is there another solution?

mitchellsimoens
1 Dec 2011, 5:28 AM
You can't do the setActiveItem on a class definition.... it has to be on an instance

myput
1 Dec 2011, 7:18 AM
Okey, i'm trying to do that with instance.
Then for add the NestedList, i must to do:


App.views.DirectoryPanel = Ext.extend(Ext.Panel, {
fullscreen: true, layout: 'fit',
listeners:{
beforeactivate : function(panel) {
App.views.directoryNestedList = new App.views.DirectoryNestedList();
panel.add(App.views.directoryNestedList);
},
}
});


And the nestedList:


App.views.DirectoryNestedList = Ext.extend(Ext.NestedList, {
title: App.config._DirectoryTitle,
fullscreen: true,
store: App.stores.DirectoryNestedListStore,
singleSelect: true,
displayField: 'name',
});

But there is some bug with the tabPanel.
When i open the nestedlist, and i change of item in the tabBar, the nestedlist is displayed for each items of the tabBar ....

How can i resolve that please ?

myput
1 Dec 2011, 7:47 AM
Okey, that's working but the error in the console is always here when i use the back arrow.


App.views.DirectoryPanel = Ext.extend(Ext.Panel, {
fullscreen: true,
layout: 'fit',
listeners:{
beforeactivate : function(panel) {
App.views.directoryNestedList = new App.views.DirectoryNestedList();
panel.add(App.views.directoryNestedList);
},
beforedeactivate: function(panel) {
panel.remove(App.views.directoryNestedList);
},
}
});


and the nestedlist:


App.views.DirectoryNestedList = Ext.extend(Ext.NestedList, {
});

and i don't need the backButton now because the nestedlist is removed and add again with a new instance.

Is this correct?
but how can i do for correct the error in console now?

thanks for help