树形网格示例不起作用

发布于 2024-11-09 12:53:01 字数 2091 浏览 0 评论 0原文

我正在尝试运行树形网格示例,但它只提供了网格,其中没有数据!

这是我的default.aspx:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>My tree grid</title>

<!-- Ext -->
<link rel="stylesheet" type="text/css" href="ExtJs4/resources/css/ext-all.css" />
<script type="text/javascript" src="ExtJs4/bootstrap.js"></script>
<script type="text/javascript" src="ExtJs4/ext-all.js"></script>


<!-- example code -->

<script type="text/javascript" src="Scripts/treepanel.js"></script>

</head>
<body>

<h1>My tree grid</h1>

<div id="tree-div"> </div>

这是我的 treepanel.js

Ext.Loader.setConfig({ enabled: true }); //

Ext.Loader.setPath('Ext.ux', '../ux');

Ext.require([
    'Ext.tip.QuickTipManager',
    'Ext.container.Viewport',
    'Ext.layout.*',
    'Ext.form.Panel',
    'Ext.form.Label',
    'Ext.grid.*',
    'Ext.data.*',
    'Ext.tree.*',
    'Ext.selection.*',
    'Ext.tab.Panel'
]);

Ext.onReady(function () 
{
 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',

        url: 'treegrid.json'////
    },
    folderSort: true
});

//Ext.ux.tree.TreeGrid is no longer a Ux. You can simply use a tree.TreePanel
var tree = Ext.create('Ext.tree.Panel', {
    title: 'Core Team Projects',
    width: 500,
    height: 300,
    renderTo: 'tree-div', 
    rootVisible:true,
    store: store,
    autoload:true,
    columns: [{xtype: 'treecolumn',  text: 'Task',   dataIndex: 'task' },{text: 'Assigned To', dataIndex: 'user'}]
});

});

我在这里做错了什么吗? 我的萤火虫没有收到错误消息...那为什么它不起作用?

如果我不能运行一个例子,我该怎么做更多......我对此感到沮丧。

I'm trying to run the treegrid example but it only gives me the grid with no data in it!

this is my default.aspx:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>My tree grid</title>

<!-- Ext -->
<link rel="stylesheet" type="text/css" href="ExtJs4/resources/css/ext-all.css" />
<script type="text/javascript" src="ExtJs4/bootstrap.js"></script>
<script type="text/javascript" src="ExtJs4/ext-all.js"></script>


<!-- example code -->

<script type="text/javascript" src="Scripts/treepanel.js"></script>

</head>
<body>

<h1>My tree grid</h1>

<div id="tree-div"> </div>

this is my treepanel.js

Ext.Loader.setConfig({ enabled: true }); //

Ext.Loader.setPath('Ext.ux', '../ux');

Ext.require([
    'Ext.tip.QuickTipManager',
    'Ext.container.Viewport',
    'Ext.layout.*',
    'Ext.form.Panel',
    'Ext.form.Label',
    'Ext.grid.*',
    'Ext.data.*',
    'Ext.tree.*',
    'Ext.selection.*',
    'Ext.tab.Panel'
]);

Ext.onReady(function () 
{
 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',

        url: 'treegrid.json'////
    },
    folderSort: true
});

//Ext.ux.tree.TreeGrid is no longer a Ux. You can simply use a tree.TreePanel
var tree = Ext.create('Ext.tree.Panel', {
    title: 'Core Team Projects',
    width: 500,
    height: 300,
    renderTo: 'tree-div', 
    rootVisible:true,
    store: store,
    autoload:true,
    columns: [{xtype: 'treecolumn',  text: 'Task',   dataIndex: 'task' },{text: 'Assigned To', dataIndex: 'user'}]
});

});

am I doing something wrong here?
I have no error msg from my firebug...so why isn't it working?

if I can't run an example how am I going to do more..I'm frustrated with this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

如何视而不见 2024-11-16 12:53:01

不确定,但“autoLoad:true”现在在面板上,但它不应该在商店上吗?

not sure, but the "autoLoad: true" is now on the panel, but shouldn't it be on the store?

痴情换悲伤 2024-11-16 12:53:01

安装 PHP 并在 IIS 中执行以下操作:

  • 单击新站点
  • 单击 MIME 类型
  • 右键单击​​空白处 >添加>文件扩展名:“json”... MIME 类型:“application/x-javascript”

添加更多详细信息:

http://www.sencha.com/forum/showthread.php?33266-Some-Problem-with-JSON&p=229858&viewfull=1#post229858

Install PHP and do the following in IIS:

  • click on the new site
  • click on MIME types
  • right click in open space > Add > File name extension: "json" ... MIME Type: "application/x-javascript"

Adding more details:

http://www.sencha.com/forum/showthread.php?33266-Some-Problem-with-JSON&p=229858&viewfull=1#post229858

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文