我有一个组合框,它需要一个树店作为它的商店。我试过下面的代码,但它不起作用。
Ext.define('DemoGroupCombo', {
extend: 'Ext.data.TreeStore',
fields: ['text', 'value'],
proxy: {
type: 'rest',
url: '../SamplePaging/GetComboTree',
//data: groupStoreData,
reader: {
type: 'json',
rootProperty: 'children'
}
}
});
来自 api 的预期 json 结果:
var groupStoreData =
//new Ext.data.TreeStore({
// root:
{
expanded: true, children: [
{
//checked: false, text: "All", expanded: true, children: [
// {
checked: false, text: "Numbers", expanded: true, children: [
{ checked: false, text: '1', value: '1', leaf: true },
{ checked: true, text: '2', value: '2', leaf: true },
{ checked: false, text: '3', value: '3', leaf: true },
{
checked: false, text: '4', value:'4', leaf: true
}
]
}
]
//}]
}
组合框:
{
xtype: 'combobox',
selModel: {
selType: 'checkboxmodel'
},
queryMode: 'local',
displayField: 'text',
valueField: 'value',
store: { type: 'DemoGroupCombo' }
}
现在我收到此错误消息:
错误:[Ext.createByAlias] 无法识别的别名:store.DemoGroupCombo