我遇到了一个问题,在定义带有内联存储的 TreePanel 时,我看不到树节点的文本。但是,如果我将存储定义外部化并将其移动到一个单独的变量中,然后如 API 文档中所示为其分配 TreePanel,它就可以正常工作。
以下是 TreePanel 的代码片段以及它在渲染时的样子:
Ext.define('MyApp.view.MyViewport', {
extend: 'Ext.container.Viewport',
initComponent: function() {
var me = this;
Ext.applyIf(me, {
items: [ {
xtype: 'treepanel',
title: 'My Tree Panel',
displayField: 'text',
store: {
"id" : "xwt-gen-92bb1629-2cfe-43c1-a40a-a8a2c4e26562",
"owners" : ["booktaxi.tree"],
"storeId" : "xwt-gen-6310be92-f272-4926-8392-ed0eacd04952",
"fields" : [],
"root" : {
"children" : [{
"children" : [],
"expandable" : false,
"id" : "775aa413-72af-4708-b2f1-8852a660cd0a",
"leaf" : true,
"root" : false,
"text" : "detention"
}, {
"children" : [{
"children" : [],
"expandable" : false,
"id" : "f2cbb9c3-c177-4870-a2f2-dceb54a781ab",
"leaf" : true,
"root" : false,
"text" : "book report"
}, {
"children" : [],
"expandable" : false,
"id" : "a4550d10-385e-4c2e-b6da-9f439cab8bd4",
"leaf" : true,
"root" : false,
"text" : "alegrbra"
}
],
"expandable" : true,
"id" : "ba8910a3-7e3f-4959-bcd0-9b3c102c40d4",
"leaf" : false,
"root" : false,
"text" : "homework"
}, {
"children" : [],
"expandable" : false,
"id" : "4f855b01-24ab-400a-ad7d-0dff14ca9710",
"leaf" : true,
"root" : false,
"text" : "buy lottery tickets"
}
],
"expanded" : true,
"id" : "a7d67f78-1a32-4077-8ce3-778b40de1835",
"leaf" : false,
"root" : true,
"text" : ""
},
"xtype" : "store.tree"
},
viewConfig: {
}
}
]
});
me.callParent(arguments);
}
});
我想知道是否有人以前遇到过这个问题,是否有办法解决这个问题。