PDA

View Full Version : [CLOSED] NavigationView shows wrong view (last view)



deshartman
4 Apr 2012, 1:46 PM
I think this is a designer bug. I have attached a simple project showing the problem.

When the Nav View is created in designer with three panels it always shows the last panel, View 3 (or any view) as the first. The expected behaviour is to show the first view when started.

I have seen the articles on how to programatically pop/push the view and only add one view at design time, but I think this is counter intuitive when using the designer. The Tab panel does not have this problem, so why is the NavView loading all views when starting?

Could this please be fixed?

Thanks
Des

deshartman
9 Apr 2012, 2:44 PM
Bump

Just updated to 363, but still has same issue. Just wondering if this has been reported somewhere?

Thanks
Des

aconran
9 Apr 2012, 3:59 PM
This is by design and part of the Sencha Touch 2 SDK.

You should dynamically push out on the views or use a card layout if you are looking for different behavior.

deshartman
9 Apr 2012, 6:12 PM
That seems like a missed opportunity to me. Why would you allow multiple views to be placed in a navigator only to have the functionality nullified by having to code everything by hand? What does this component provide other than a toolbar then?

I would argue that the design is in fact not correct. If I was presented with the component that is in fact a container for other components, I would expect it to manage its sub components. You already have this functionality in the tab bar, so I do not agree with your statement.

Can the functionality used in the tab bar not be used here? What about adding the ability to show a particular card with active item? Seems crazy to me that you would by design show the last card in this component, yet offer the functionality in tab bar?

Any other developers agree?

Thanks
Des

deshartman
9 Apr 2012, 8:00 PM
Can I reopen this thread and maybe get a vote on how many people feel we should have this functionality?

Thanks
Des

aconran
10 Apr 2012, 8:08 AM
Can I reopen this thread and maybe get a vote on how many people feel we should have this functionality?


This thread is not locked and people are free to comment on this thread. When a thread is marked as [OPEN] it just means that internally we have work associated with this ticket and its actively in our queue of things to be worked on. [CLOSED] just means that it has been reported as a bug and we've deemed it as not a bug/by design/etc.

While I understand what you are looking for, this goes against the Sencha Touch way of doing things. Inside of Designer, one thing that we have tried very hard to do is to keep aligned with the ways our SDK works. We don't want to diverge and create a Designer way of doing something and a SDK/raw coding way of doing things. That being said, we are always trying to make your life easier within the Designer.

What you should be doing is creating each card that you want to add to the navigation view as top level components within Designer and then manually pushing them onto the navigation view when they are needed.

deshartman
10 Apr 2012, 1:40 PM
Aaron

Thanks for the explanation, however I do not understand what the difference between the way the TabPanel and NavigationView is represented then?

A Tab panel has a "control bar" (Tab Bar) which controls its Items. Items (cards) are displayed based on an ActiveItem and in the designer as well as SDK you switch the cards with tab buttons.

A NavigationView has a "control bar" (Navigation Bar) which controls its Items. Defining the cards ahead of time (like the tab panel should not break the SDK). The only thing missing is the concept of which view is displayed first. If you add an activeItem to the NavView, you could select which card is displayed first and from there push or pop views could you not?

I cannot see how you are breaking the SDK, by allowing multiple Items (the same way as a Tab Panel) in a Navigation View and controlling how they are displayed?

What part am I missing here?


Thanks
Des

deshartman
10 Apr 2012, 2:35 PM
Aaron


Had a look through the code and have two possible solutions I would like you to consider:


1) The "applyActiveItem" function is where you set the code to show the last item. My thinking is if you change this to show the first item instead of the last it would make more sense from a SDK and Designer sense. If this shows the first view in the card stack it makes more sense, since the user will always start at the first view (card) in the stack and navigate to the next view and back when done. Why was the last view selected?


2) An alternative approach is to at least expose the activeItem, so this can be set. The "applyActiveItem" will be an issue though, since I believe it will override the activeItem setting.




I know the NavigationView is a relatively new component, so I hope you are willing to consider these changes to make it better not only in the Designer, but also the SDK


Change this:



applyActiveItem: function(activeItem, currentActiveItem) {
var me = this,
innerItems = me.getInnerItems();


// Make sure the items are already initialized
me.getItems();


// If we are not initialzed yet, we should set the active item to the last item in the stack
if (!me.initialized) {
activeItem = innerItems.length - 1;
}


return this.callParent([activeItem, currentActiveItem]);
}




to this:



applyActiveItem: function(activeItem, currentActiveItem) {
var me = this,
innerItems = me.getInnerItems();


// Make sure the items are already initialized
me.getItems();


// If we are not initialzed yet, we should set the active item to the FIRST item in the stack
if (!me.initialized) {
activeItem = 0;
}


return this.callParent([activeItem, currentActiveItem]);
}








Thanks
Des

taptapdone
11 Apr 2012, 11:17 AM
"When the Nav View is created in designer with three panels it always shows the last panel, View 3 (or any view) as the first. The expected behaviour is to show the first view when started."


While a back button shows up on the wrong view, if you actually test a deployed project, and go to the view, there's no way to return to it.

Shouldn't a forward/next button also be associated? Either explicitly, or with the title of the next panel in the stack?