简体   繁体   English

Sencha Touch - NavigationView中的NestedList

[英]Sencha Touch - NestedList inside a NavigationView

My whole application is inside a NavigationView which handles navigation between different screens. 我的整个应用程序位于NavigationView ,用于处理不同屏幕之间的导航。 In the main screen I have a button that opens a NestedList (always inside the NavigationView) 在主屏幕中,我有一个打开NestedList的按钮(总是在NavigationView内)

NavigationView中的NestedList

How can I remove the NestedList Toolbar , and be able to handle navigation with the main NavigationView Toolbar instead ? 如何删除NestedList工具栏 ,并能够使用主NavigationView工具栏处理导航?

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. 嵌套列表的后退按钮将始终使用textdisplayField config作为应用于它的文本,导航视图的back按钮将包含其他一些文本。

I've made fiddle to show how it'd look. 我做了小提琴来展示它的样子。 If possible, you may want to consider this too. 如果可能,您也可以考虑这一点。 see demo fiddle 看演示小提琴

UPDATE 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. 例如,在嵌套列表/视图的onShow()中。

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 http://docs.sencha.com/touch/2-1/#!/api/Ext.dataview.NestedList

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

useToolbar: false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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