2 laoyao bupt laoyao_bupt 于 2013.06.14 10:48 提问

extjs3 treePanel 如何监听delete按键 并删除树节点

我用的extjs3.问题困扰了我好长段时间,求高手关注啊!
我的代码如下:

var leftTreePanel = new Ext.tree.TreePanel({
        id : 'left_tree_panel',
        autoScroll : true,
        animate : true,
        enableDD : true,
        enableDrag:true,
        ddGroup: "GridDD",
        title : '本地分类',   
        border : false,


        selModel: new Ext.tree.MultiSelectionModel(),
        keys: new Ext.KeyMap(this.el, [
                                                 { 
                                                    key: 46 // DEL
                                                    , scope: this
                                                    , fn: function(key, e) {
                                                        var sm = this.getSelectionModel();
                                                        var node = sm.getSelectedNode();
                                                        console.log( node );
                                                             alert(e.getKey());
                                                }}]),

        height:leftTreePanelHeight,
        loader : new Ext.tree.TreeLoader({
          dataUrl : 'tree/userClassifyTree.jsp?type=load&nodeId=1&filterId=<%=filterIdStr%>',
          listeners : {
             "loadexception":function(loader,node,response){
                //加载服务器数据,直到成功
                //node.loaded = false;
                //node.reload.defer(10,node);
             }
            },
            "keydown" : function(){
            }
        }),
        root : {
            nodeType : 'async',
            text : '我的分类',
            draggable : false,
            leaf : false,
            expanded : true,
            id : 'folder_1'
        }
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!