xx125556 2011-08-24 12:21
浏览 233
已采纳

求S2SH+ext tree带checkbox的代码 急~~~~

tree是个权限导航树 能进行修改什么的 有的发邮件290806418@qq.com 急啊 ~~~~~~~~~~~~~~~~~~~

  • 写回答

4条回答 默认 最新

  • myali88 2011-08-24 20:32
    关注

    [code="java"]
    Ext.onReady(function() {
    var store = Ext.create('Ext.data.TreeStore', {
    proxy: {
    type: 'ajax',
    url: 'check-nodes.json'
    },
    sorters: [{
    property: 'leaf',
    direction: 'ASC'
    }, {
    property: 'text',
    direction: 'ASC'
    }]
    });

    var tree = Ext.create('Ext.tree.Panel', {
        store: store,
        rootVisible: false,
        useArrows: true,
        frame: true,
        title: 'Check Tree',
        renderTo: 'tree-div',
        width: 200,
        height: 250,
        dockedItems: [{
            xtype: 'toolbar',
            items: {
                text: 'Get checked nodes',
                handler: function(){
                    var records = tree.getView().getChecked(),
                        names = [];
    
                    Ext.Array.each(records, function(rec){
                        names.push(rec.get('text'));
                    });
    
                    Ext.MessageBox.show({
                        title: 'Selected Nodes',
                        msg: names.join('<br />'),
                        icon: Ext.MessageBox.INFO
                    });
                }
            }
        }]
    });
    

    });
    [/code]
    这个是extjs里面提供的例子,上面的“check-nodes.json”就是tree需要的数据格式:
    [code="java"]
    [{
    "text": "To Do",
    "cls": "folder",
    "expanded": true,
    "children": [{
    "text": "Go jogging",
    "leaf": true,
    "checked": true
    },{
    "text": "Take a nap",
    "leaf": true,
    "checked": false
    },{
    "text": "Climb Everest",
    "leaf": true,
    "checked": false
    }]
    },{
    "text": "Grocery List",
    "cls": "folder",
    "children": [{
    "text": "Bananas",
    "leaf": true,
    "checked": false
    },{
    "text": "Milk",
    "leaf": true,
    "checked": false
    },{
    "text": "Cereal",
    "leaf": true,
    "checked": false
    },{
    "text": "Energy foods",
    "cls": "folder",
    "children": [{
    "text": "Coffee",
    "leaf": true,
    "checked": false
    },{
    "text": "Red Bull",
    "leaf": true,
    "checked": false
    }]
    }]
    },{
    "text": "Remodel Project",
    "cls": "folder",
    "children": [{
    "text": "Finish the budget",
    "leaf": true,
    "checked": false
    },{
    "text": "Call contractors",
    "leaf": true,
    "checked": false
    },{
    "text": "Choose design",
    "leaf": true,
    "checked": false
    }]
    }]
    [/code]
    你只需要使用struts2产生这样的json数据就可以了。产生json,可以使用struts2-json-plugin.jar这个插件,具体使用你可以参考一下:[url]http://struts.apache.org/2.2.3/docs/json-plugin.html[/url]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况