开发者

treegrid example doesn't work

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" typ开发者_StackOverflow中文版e="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.


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜