Ext 生成带有checkbox的tree选中问题
本人因为工作需要,了解了一点点的ext,利用前人的代码做了一个带有复选框的树状图,但是不知道为什么生成之后点击复选框不能选中,点击节点其他位置就能选中,求高人指点。
贴出代码如下:
var dataPanel;
         Ext.onReady(function () {
             // 资源列表模型定义
             Ext.define('OrgModel', {
                 extend: 'Ext.data.Model',
                 fields: [
                         { name: 'IndexGuid', type: 'string' },
                         { name: 'text', type: 'string' },
                         { name: 'id', type: 'string' }
                     ]
             });
             // 菜单数据源
             var store = Ext.create('Ext.data.TreeStore', {
                 autoLoad: true,
                 model: 'OrgModel',
                 proxy: {
                     type: "ajax",
                     url: "TransactiorEd.ashx"
                 },
                 root: {
                     id: "",
                     text: 'Root',
                     expanded: true
                 },
                 listeners: {
                     //注意beforeload的参数。与3.x中的不同
                     beforeload: function (ds, opration, opt) {
                         opration.params.parentid = opration.node.data.IndexGuid; //获得节点的相应属性,也有所不同
                         opration.params.type = "unadmin";
                     }
                 },
                 folderSort: true
             });
             // 数据树形列表
             dataPanel = Ext.create('Ext.tree.Panel', {
                 //title: '数据资源',
                 width: 376,
                 height: 250,
                 store: store,
                 autoScroll: true,
                 rootVisible: false,
                 useArrows: true,
                 layout: 'fit',
                 //renderTo: 'Div_tree',
                 region: 'center',
                 //		            hrefTarget: 'mainFrame',
                 //renderTo: Ext.getBody(),
                 listeners: {
                     //选中用户
                     itemclick: function (record, item, index) {
                         if (item.data.checked != null) {
                             item.set('checked', !item.data.checked);
                         }
                         if (!item.isExpanded())
                             item.expand();
                         else {
                             item.collapse();
                         }
                     }
                 }
             });
------解决方案--------------------
节点的click事件跟checkbox冲突了 ,应该是这个,楼主仔细看下