-
3 Nov 2011 8:42 AM #11
The only difference I see with yours and mine is as follows:
Where you have:
I would just haveCode:index: function(options) { if ( ! this.indexView) { this.indexView = this.render({ xtype: 'DirectoryIndex', }); } this.application.viewport.setActiveItem(this.indexView, options.animation);
I do not have the "options" and "options.animations" and I also just have "index" where you have "DirectoryIndex"Code:index: function() { if ( ! this.indexView) { this.indexView = this.render({ xtype: 'index', }); } this.application.viewport.setActiveItem(this.indexView);
This is all i can see at the mo.Last edited by simondavies; 3 Nov 2011 at 8:43 AM. Reason: Pressed submit rather than preview so had to add more info
-
3 Nov 2011 8:50 AM #12
yes that strange ;.. i can't call index because in my viewport, i have:
Then it's that, Directory/index, i don't know why it doesn't work ...Code:App.views.Viewport = Ext.extend(Ext.Panel, { fullscreen: true, layout: 'card', cardSwitchAnimation: 'slide', dockedItems: [ { xtype: 'TabBarMvc', items: [ { text: App.config._DirectoryTitle, iconCls: App.config._DirectoryIconCls, route: 'Directory/index', }, { text: App.config._SearchTitle, iconCls: App.config._SearchIconCls, route: 'Search/index', } ] } ] });
-
4 Nov 2011 1:16 AM #13
All I have in my viewport is as follows:
In my main app js file I have:Code:App.views.Viewport = Ext.extend(Ext.Panel, { fullscreen: true, layout: 'card', cardSwitchAnimation: 'slide' });
Code:Ext.regApplication({ name: "App", defaultUrl: 'app/index', launch: function() { this.viewport = new this.views.Viewport(); } });
Hope this helps, otherwise if you want to pm or send a zip version of what it is your doing and I can try to have a look etc
Thanks
-
4 Nov 2011 1:28 AM #14
Yes i have the same ... Just in my Viewport i have 4 views in a bottom toolbar... I don't understand -_-
-
4 Nov 2011 2:33 PM #15
I believe I have solved the issue.
Firstly please find below the code i added to get this to work:
Your DirectoryController.js File:
Code:Ext.regController('Directory', { index: function(options) { if ( ! this.indexView) { this.indexView = this.render({ xtype: 'DirectoryIndex', }); } this.application.viewport.setActiveItem(this.indexView, options.animation); var homeBtn = this.application.viewport.query('#homeBtn')[0]; homeBtn.setHandler( function(){ Ext.redirect('Search/index'); }); }, });
Your DirectoryIndexView.js file
Now the issue I believe is that as you have it on your main controller/home section your already on the home page. (index.html#Directory/index) so in my earlier code that you tried and said that you got it to register an Alert but not goinb back is because to go home I was calling 'Directory/index' within my Ext.redirect('Directory/index') and as we are already on this page its got nowhere else to go.Code:App.views.DirectoryIndex = Ext.extend(Ext.NestedList, { title: App.config._DirectoryTitle, store: App.stores.DirectoryIndexStore, fullscreen: true, singleSelect: true, displayField: 'name', useTitleAsBackText: false, backText: '', getItemTextTpl: function() { var tplConstructor = loadURL(App.config.host + App.config.DirectoryTPL + 'DirectoryIndex.html'); return tplConstructor; }, listeners: { afterrender: function() { this.toolbar.remove(this.backButton); this.backButton = new Ext.Button({ ui: 'plain', iconMask: true, useTitleAsBackText: false, iconCls: 'arrow_left', scope: this, handler: this.onBackTap }); this.toolbar.add(this.backButton); }, scope: App.views.DirectoryIndex, }, toolbar: { componentCls: 'x-toolbar-dark', items: [{xtype: 'spacer'},{iconCls: 'home', iconMask: true, id: 'homeBtn'}], }, }); Ext.reg('DirectoryIndex', App.views.DirectoryIndex);
I tested this by simply putting another page/view call within the Ext.redirect and it worked fine and opened the search section up. (see above I have used the 'search/index' in the Ext.redirect code)
try this and you will see the home page works.
so what you need to do is if you want to call the Directory/index in the code then you need to some how reset it so it loads the first data list from the nested view.
Hoep this helps
-
7 Nov 2011 12:41 AM #16
Hum yes exactly, thanks, the method works fine
.
Yes it's that, i look for a method able to initialize again my view in fact.
It's for this reason, i found a solution, consist to destroy the view:
But it doesn't work for the moment, i can't implement it... And how to initialize the view again.Code:listeners: { deactivate: function(this.indexView) { this.indexView.destroy(); } },
do you know?
-
10 Nov 2011 1:24 AM #17
Hi myput sorry not been intouch, been working on other projects at mo and busy, have you solved this issue yet? Otherwise I will have a look
Thanks
-
10 Nov 2011 1:48 AM #18
Hey, thanks
no problem,
No i'm trying to remake the application without extern scripts etc ... and for the moment, i have an MVC application with my views but i have a problem for load html and views in render ... I don't know why for the moment.
and the controller for example HomeCode:App.views.Viewport = Ext.extend(Ext.Panel, { id: 'viewport', fullscreen: true, layout: 'card', dockedItems: [ new Ext.TabPanel({ fullscreen: true, layout: "card", tabBar: { dock: 'bottom', layout: { pack: 'center' } }, cardSwitchAnimation: { type: 'fade' }, defaults: { scroll: 'vertical' }, items: [ { title: App.config._HomeTitle, iconCls: App.config._HomeIconCls, controller: 'Home', action: 'index' },{ title: App.config._DirectoryTitle, iconCls: App.config._DirectoryIconCls, controller: 'Directory', action: 'index', } ], listeners: { cardswitch: function(tabPanel, newCard, oldCard, index, animated) { if(newCard.controller && newCard.action){ Ext.dispatch({ controller: newCard.controller, action: newCard.action, historyUrl: newCard.controller+"/"+newCard.action, animation: {type:'slide',direction:'left'} }); } } } }) ] });
when i put an alert before this.indexView = this.render({, the alert is displayed, but i can't display html in this.indexViewCode:Ext.regController('Home', { index: function(options) { this.indexView = this.render({ xtype: 'App.views.homeView', listeners: { deactivate: function() { App.views.homeView.destroy(); } } }); this.application.viewport.setActiveItem(this.indexView, null); } });
I don't know why for the moment ...
-
10 Nov 2011 1:01 PM #19
Have not had chance to look at this but I suggest as its a new try and error that you post another thread, then others can see this and also helps :-), send a link when done so I can pick it up as well.
Thanks
-
14 Nov 2011 12:07 AM #20


Reply With Quote