嵌套列表,多种布局 [英] Nested List, Multiple Layouts
问题描述
在Sencha Touch 2.1中,我定义了以下嵌套列表:
In Sencha Touch 2.1, I have the following nested list defined:
xtype: 'NestedList',
docked: 'top',
ui: 'light',
store: treeStore,
detailCard: true,
detailContainer: // Reference to a Another Panel
我可以显示嵌套列表,但是事实证明通过JSON添加项目是有问题的.这是我的JSON示例:
I can get the Nested List to appear, but adding items via JSON is proving problematic. Here's a sample of my JSON:
[
{
"BranchID" : 4,
"BranchName" : "Branch Name",
"Jobs" : [
{
"JobOrderID" : 75,
"JobTitle" : "Job Title",
"leaf" : true
}
]
}
]
这是我的树存储和列表项:
And here is my Tree Store and List Item:
// Define a List Item:
Ext.define('Branch', {
extend: 'Ext.data.Model',
config: {
fields: [
'BranchID',
'BranchName'
]
}
});
var treeStore = Ext.create('Ext.data.TreeStore', {
model: 'Branch',
defaultRootProperty: 'items',
proxy: {
type: 'ajax',
url: 'data/region.php'
}
});
我可以看到正在调用data/region.php,并且它正确返回了JSON-但列表项未显示.如何显示列表项?
I can see that data/region.php is being called, and it's correctly returning JSON - but the list items do not show up. How do I get the list items to show up?
此外,我想对叶节点使用不同的布局-并使这些叶节点在单独的面板中上拉请求.如何识别面板,以便可以在NestedList的DetailContainer部分中引用它?
Additionally, I'd like to use a different layout for the leaf nodes - and to have those leaf nodes pull up a request in a separate panel. How do I identify the panel, so I can reference it in the DetailContainer section of my NestedList?
我正在寻找的东西:
- 分支机构列表
- 点击分支,列出所有作业
- 轻按一项工作,详细信息会显示在其他面板中.
我已经阅读了文档,但是在更复杂的实现上似乎有点稀疏.
I've read the documentation, but it seems a little sparse on more complex implementations.
推荐答案
根据我的Sencha经验,我的建议是永远不要使用Ext.NestedList
.当然,当您的模型非常简单时,它们非常方便,但是当您的模型包含关联时,则很难自定义.
From my Sencha Experience, my advice would be never to use Ext.NestedList
. Of course they are quite handy when your model is very simple but hard to customize when you model contains associations for instance.
因此,我要做的(是做的)是使用Ext.navigation.View
并在点击以前列表中的项目时推送新列表.这是与Ext.NestedList
完全相同的概念,因此它不会使您的应用程序超载.
So what I would do (and did) is to use an Ext.navigation.View
and push new lists as you tap on items of previous lists. This is the exact same concept as a Ext.NestedList
so it won't overload your application.
如果您有任何问题,请随时提问
If you have any question feel free to ask
希望这对您有帮助
这篇关于嵌套列表,多种布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!