Checkbox 如何在extjs4中创建带有复选框的树视图

Checkbox 如何在extjs4中创建带有复选框的树视图,checkbox,extjs4,treeview,Checkbox,Extjs4,Treeview,我在Extjs4中工作。我想创建带有复选框的树状视图,用于选择单个条目。 我有json作为- {"data":[{"Maincategory":"Main","maincategoryId":"1","Subcategory":{"subcategory":"GK","categoryId":"2"},{"subcategory":"History","categoryId":"3"},{"subcategory":"Geography","categoryId":"4"}]},{"Mainca

我在Extjs4中工作。我想创建带有复选框的树状视图,用于选择单个条目。 我有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中创建带有复选框的树视图。

将Ext.selection.CheckboxModel作为selectionmodel添加到树面板中

像这样的东西

{
 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',
 .....