2 woaihewen11 woaihewen11 于 2013.12.03 10:34 提问

extjs4获取带url参数的json文件

这里是treeReport.json
{children:[
{id:'01',text:'报表管理',children:[
{id:'01-01',url:'mainPage.jsp?v=',text:'网运报表',leaf:true},
{id:'01-02',text:'数据统计报表',children:[
{id:'01-02-01',url:'mainPage.jsp?v=',text:'b01-02-01',leaf:true},
{id:'01-02-02',url:'mainPage.jsp?v=',text:'a01-02-02',leaf:true}
]},
{id:'01-03',url:'mainPage.jsp?v=',text:'b01-03',leaf:true}
]},
{id:'02',url:'mainPage.jsp?v=',text:'b02',leaf:true}
]}

var treeStore1 = Ext.create('Ext.data.TreeStore', {
            autoLoad : true,
            proxy: {
                type: 'ajax',
                url: '../data/treeReport.json',
                reader: {
                    type: 'json',
                    root: 'children'
                    //record: 'node'
                }
            },
            sorters: [{
                property: 'leaf',
                direction: 'ASC'
            }],
            root: {
                nodeType: 'async',
                text: 'Ext JS',
                //id: '00',
                expanded: true
            }
        });


        var treepanel2 = Ext.create('Ext.tree.Panel', {
            //title: '简单的树形组件',
            store: treeStore1,
            animate:true,
            autoScroll:true,  //如果超出范围带自动滚动条
            width: 500,
            height:400,
            border:true,    //显示tree side frame
            //数据容器
            //loader:new Ext.tree.TreeLoader({url:"web/MenuTree.json"}),
            rootVisible: true,  //是否显示根节点
           // renderTo: Ext.getBody()
            containerScroll:true,
            listeners: {
                'itemclick': function (view, record) {
                        var leaf = record.get('leaf');
                        if (leaf) {
                            alert(record.get('url'));
                            var id = record.get('id');//id能获取到
                            var url = record.get('url');//url不能获取
                            var text = record.get('text');//text也能获取
                            alert("url=="+url+"id="+id+"text"+text);
                            var tabPanel = Ext.getCmp('MAINPANEL');
                            openWithTabPanel(id,url,text);
                        }
                        else {
                            alert('not leaf!');
                            var expand = record.get('expanded')
                            if (expand) {
                                view.collapse(record);
                            }
                            else {
                                view.expand(record);
                        }
                    }
                }
            }  //listeners -------funcation end----------
        });

请各位大侠帮我看看怎么才能获取这个url路径

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!