如何使用 firebug 调试 Extjs store url: path ?
我正在使用 浏览器-我的应用程序的布局示例。
我正在尝试添加 树网格< /strong> 到它。我定义了一个新类,但是当我调用树网格时,我可以看到网格,但里面没有数据。
我想做的是在单独的文件中定义树网格。我的主文件是 layout-browser.js
,我需要将其添加到其中的选项卡中。我可能做错了什么?
这是我的代码:
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]
});
感谢您的时间和帮助
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.
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?
here is my code:
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]
});
thank you for ur time and help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个工作示例,您可以定义 myTree 并在浏览器布局中调用它!
转到 firebug NET 控制台,刷新页面并搜索 treeGrid.json,
将鼠标悬停在上面即可查看完整的 URL
使用从本地存储到包含 .json 的文件夹的正确路径更新存储
立即尝试!
Here is an working example, u can define myTree and call it in your Browser-layout!
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!