treegrid示例不起作用

时间:2011-05-24 10:00:19

标签: asp.net json iis extjs treegrid

我正在尝试运行treegrid示例,但它只给了我没有数据的网格!

这是我的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'}]
});

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

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

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

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

  • 点击新网站
  • 点击MIME类型
  • 右键单击开放空间&gt;添加&gt;文件扩展名:“json”... MIME类型:“application / x-javascript”

添加更多详情:

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