浏览 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');
});
声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
|
| 返回顶楼 | |
|
时间:2008-04-08
楼上最好说的详细点,比如你用什么方式接收的?
|
|
| 返回顶楼 | |
|
时间:2008-07-08
把jsp也贴出来
|
|
| 返回顶楼 | |



