The code snippet you posted from init.js looks fine, but I would want to look for any extra calls to KONtx.application.addViewConfig in your code, which will dynamically add a new view everytime it is called. Look for such calls in your code.
Thanks - that definitely helped.
But now I'm running into another problem (and I think I see why the original code was written the way it was):
I have menus under menus, and if I get rid of the code creating new views, they all end up using the 'view-Menu' ID. But when I try to load it, I get the error "You can't switch to a view you are already on".
I'm looking at the API documentation but I can't see a simple way to just change the data in a view and reload it - in fact, I'm not seeing a method for changing the data in a view at all. I'm sure it exists, but I'm just missing it. If I could do that, then I wouldn't have to worry about changing the views.
Also, I'm pretty sure my 'fix' isn't all that great, since it still calls addViewConfig, just without changing the ID. Here is what I had:
CODE
var newViewID = 'view-Menu-' + this.my_item.guid;
KONtx.application.addViewConfig({
id: newViewID,
viewClass: MenuView,
data: this.my_item
});
KONtx.application.loadView(newViewID);
I tried changing it to:
CODE
KONtx.application.loadView(
'view-Menu',
{data: this.my_item}
);
- but that wouldn't do anything at all. I changed it to:
CODE
var newViewID = 'view-Menu';
KONtx.application.addViewConfig({
id: newViewID,
viewClass: MenuView,
data: this.my_item
});
KONtx.application.loadView(newViewID);
- that loads the view first time around but not when I try to go to a sub-menu. And I'm not sure it would fix the memory problem even if it did load the sub-menus.
So what I WANT to do here is when I select a menu, it will load the menu view, then when I select a sub-menu, it updates the data in the menu view to the new info and then displays that - I suppose that would be without actually CHANGING views, only re-displaying the current...
I know I'm probably missing something really basic, but I've been looking over the documentation and I'm really just not seeing what I'm missing - sorry to be asking such basic questions! (I'm still trying to puzzle this out on my own, but your help is appreciated)