论坛首页 入门讨论版 EXT

数据不在grid显示,请指教!

浏览 495 次
该帖已经被评为新手帖
作者 正文
时间:2008-01-06 关键字: extjs, spring, hibernate, json
Firebug显示有值,如下:
{"results":[{"username":"admin"},{"username":"signup-user"},{"username":"user"}]}

但是Grid不显示数据,请指点!


/*
 * Ext JS Library 2.0
 * Copyright(c) 2006-2007, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */

Ext.onReady(function(){

  	Ext.QuickTips.init();
   
   // fix the bug in codepress - resize
   Ext.BoxComponent.prototype.setSize('100%','25px');

   /************************************************************
	* Display the result in page
    * the column model has information about grid columns
    * dataIndex maps the column to the specific data field in
    * the data store (created below)
    ************************************************************/
    var userCM = new Ext.grid.ColumnModel([
        new Ext.grid.RowNumberer(),
        {
            header: "Username", 
            width: 100, 
            dataIndex: 'username'
        }
    ]);   
	    
   /************************************************************
    * connect to backend - grid - core part
    * create the Data Store
    *   connect with backend and list the result in page
    *   through JSON format
    ************************************************************/    
    var dataStore = new Ext.data.Store({
        // load using script tags for cross domain, if the data in on the same domain as
        // this page, an HttpProxy would be better
        proxy: new Ext.data.HttpProxy({
           url: '/boss/users.html'
        }),
        
        // create reader that reads the Topic records
        reader: new Ext.data.JsonReader({
            root: 'results'
        }, [
           {name: 'username'}
        ])
    });
	// trigger the data store load
	dataStore.load();	
	
	var gridPanel = new Ext.grid.GridPanel({
        border:false,	                        
        ds: dataStore,
        cm: userCM,	
        
        viewConfig: {forceFit:true}
    });
	gridPanel.render('grid-example');
});
   
时间:2008-04-08
楼上最好说的详细点,比如你用什么方式接收的?
   
0 请登录后投票
时间:2008-07-08
把jsp也贴出来
   
0 请登录后投票
论坛首页 入门讨论版 EXT

跳转论坛:
JavaEye推荐