如何调试Extjs存储url:路径与firebug? [英] How to debug Extjs store url: path with firebug?

查看:147
本文介绍了如何调试Extjs存储url:路径与firebug?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 我的应用程序的浏览器布局 示例。

I am using the browser-layout example for my application.

我正在尝试添加一个 树形网格 。我定义了一个新类,但是当我打电话给我的树网格时,我可以看到网格,但没有数据。

I'm trying to add a tree grid to it. I defined a new class, but when I call my tree grid I can see the grid but no data inside.

我要做的是定义树网格在一个单独的文件。我的主要文件是 layout-browser.js ,我需要在我所在的选项卡中添加(和其他)。我可能会做错什么?

What I'm trying to do is define the tree grid in a separate file. My main file is the layout-browser.js and I need to add this (and others) in the tabs I have in it. What might I be doing wrong?

这是我的代码:

Ext.require([
'Ext.data.*',
'Ext.grid.*',
'Ext.tree.*'
]);

Ext.define('Task', {
    extend: 'Ext.data.Model',
    fields: [
        { name: 'task', type: 'string' },
        { name: 'user', type: 'string' },
        { name: 'duration', type: 'string' }
    ]
});

var store = Ext.create('Ext.data.TreeStore', {
    model: 'Task',
    proxy: {
        type: 'ajax',
        //the store will get the content from the .json file
        url: 'treegrid.json'
    },

    folderSort: true
});



var tree = new Ext.tree.Panel({
title: 'Core Team Projects',
store : store,

columns:[
{
    header: 'Task',
    dataIndex: 'task',
    width: 80
},{
    header: 'Duration',
    width: 80,
    dataIndex: 'duration',
    //align: 'center',
    //sortType: 'asFloat'

},{
    header: 'Assigned To',
    width: 80,
    dataIndex: 'user'
}] 
});


Ext.define("Ext.app.myTreeGrid", {
    extend: "Ext.panel.Panel",


width: 300,
height : 300,
items: [tree]

});

感谢您的时间和帮助

推荐答案

var store = Ext.create('Ext.data.TreeStore', {
proxy:{
    type: 'ajax',
    url: 'myTree.json',
},
reader:{
    type: 'ajax',
    root: 'nodes',
    record: 'leaf'
 }  
}); 


var myTree = Ext.create('Ext.tree.Panel', {
    store: store,
    rootVisible: false,  
    border: false,
    renderTo:Ext.getBody() //missing

});  

JSON

  {

    children: [
        { text:"Clients", expanded: true,
            children: [{ text:"MAIN", leaf: true }]
        }
    ]
  }

这是一个工作示例,您可以定义myTree并在浏览器布局中调用它!

Here is an working example, u can define myTree and call it in your Browser-layout!


转到firebug NET控制台,刷新页面并搜索treeGrid.json,




用鼠标悬停以查看完整的URL



更新从localstore到具有.json
的文件夹的正确路径的商店



立即尝试!

Go to firebug NET console, refresh the page and search for treeGrid.json,

Hover over with mouse to see full URL

Update store with correct path from localstore to a folder with your .json


Try now!

这篇关于如何调试Extjs存储url:路径与firebug?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆