JSON 데이터 & XTemplate으로로드 된 스토어로 앱의 사이드 바 탐색을 만들려고합니다. 기본 카테고리 & 하위 카테고리가 있습니다. 그러나 카테고리는 드로잉 중이며 사이드 바에있는 하위 카테고리를 생성/렌더링하지 않습니다. 문서를 보면 광산은 "아이들"예제와 거의 동일합니다. 내가 도대체 뭘 잘못하고있는 겁니까?EXTJS4.1 XTemplate이 상점에서 가져 오지 않음
문서 : http://docs.sencha.com/ext-js/4-1/#!/api/Ext.XTemplate
모델
Ext.define('APP.model.SideBar', {
extend: 'Ext.data.Model',
fields: [
{name: 'group', type: 'string'},
{name: 'tools', type: 'string', mapping: 'tools'}
],
proxy: {
type: 'ajax',
url : '/js/res/sidebar.json',
reader: {
type: 'json',
root: 'items'
}
}
});
sidebar.json
{"items": [
{
"group": "Category1",
"tools": [
{"name": "Sub A1"}
]
},{
"group": "Category2",
"tools": [
{"name": "Sub B2"},
{"name": "Sub B3"}
]
}]}
보기 그것은 그립니다 {그룹}가 아닌 {tools.name}
Ext.define('APP.view.SideBar', {
alias: 'widget.appsidebar',
extend: 'Ext.view.View',
id: 'sidebar',
width: 180,
border: false,
cls: 'sidebar-list',
selModel: {
deselectOnContainerClick: false
},
store: 'SideBar',
itemSelector: '.apptool',
tpl: [
'<tpl for=".">',
'<div class="sidebar-title">{group}</div>',
'<tpl for="tools">',
'<div class="apptool">{name}</div>',
'</tpl>',
'</tpl>'
]
});