简体   繁体   中英

Sencha Touch - NestedList inside a NavigationView

My whole application is inside a NavigationView which handles navigation between different screens. In the main screen I have a button that opens a NestedList (always inside the NavigationView)

NavigationView中的NestedList

How can I remove the NestedList Toolbar , and be able to handle navigation with the main NavigationView Toolbar instead ?

To make navigation view's back button behave like nested list's back button, you need to override navigation view's back button tap event. To do this follow my answer on similar question , How to override back button on Navigation View .

Once you're done with this, you need to identify each time, which view is currently displayed. If it's a normal view other than nested list you can simple pop that view.

But if it's a nested list then -

  1. you'd have to find it's level. I mean on which level you are right now.
  2. Find it's parent item from list.
  3. load that view.

But doing all these will require lot of efforts and consume time. Instead you can place nested list's toolbar config at bottom with and two separate back buttons at different places. Nested list's back button will always consume text or displayField config as text applied to it and back button of navigation view will have some other text.

I've made fiddle to show how it'd look. If possible, you may want to consider this too. see demo fiddle

UPDATE

If you still want to go for what you've mentioned in question. Here's another way..

Don't push nested list view inside navigation view. Use nested list itself and try to add Back button and other buttons to toolbar at top at first level only. Then after going deep, you'll get back button automatically. And from first level, write custom handler that will pop nested list ie current view and will load previous view. If you want I'll try to help you out with this in my spare time.

Try this code:

yourNestedList.getToolbar().hide();

for example in the onShow() of your nestedlist/view.

In the docs you can see a list of methods you can use for a Nestedlist:

http://docs.sencha.com/touch/2-1/#!/api/Ext.dataview.NestedList

您也可以在嵌套列表中将其用作配置:

useToolbar: false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM