我在Extjs4工作。我想用checkBoxes创建树视图以选择单个条目。 我有json作为 -
{"data":[{"Maincategory":"Main","maincategoryId":"1","Subcategory":{"subcategory":"GK","categoryId":"2"},{"subcategory":"History","categoryId":"3"},{"subcategory":"Geography","categoryId":"4"}]},{"Maincategory":"GK","maincategoryId":"2","Subcategory":[{"subcategory":"environment","categoryId":"5"}]},{"Maincategory":"History","maincategoryId":"3","Subcategory":[{"subcategory":"civics","categoryId":"7"}]},{"Maincategory":"Geography","maincategoryId":"4","Subcategory":[{"subcategory":"India","categoryId":"8"}]},{"Maincategory":"environment","maincategoryId":"5","Subcategory":[]}]}
我想创建这个json的树视图。那么如何使用extjs4中的复选框创建树视图。
答案 0 :(得分:0)
将Ext.selection.CheckboxModel作为selectionmodel添加到您的treepanel
有点像这样
{
xtype: 'treepanel',
style: 'margin-top: 10px;',
itemId: 'searchresultstreepanel',
flex: 1,
autoScroll : true,
store: me.searchResultsStore,
rootVisible: false,
loadMask: true,
selModel: Ext.create('Ext.selection.CheckboxModel',{
mode: 'MULTI'
}),
selType: 'treemodel',
.....