数据如下:{"root":[{"age":20,"birthday":"2012-02-22","demo":"备注信息哈0","name":"张0","sex":"男"},{"age":21,"birthday":"2012-02-22","demo":"备注信息哈1","name":"张1","sex":"男"},{"age":22,"birthday":"2012-02-22","demo":"备注信息哈2","name":"张2","sex":"男"},{"age":23,"birthday":"2012-02-22","demo":"备注信息哈3","name":"张3","sex":"女"},{"age":24,"birthday":"2012-02-22","demo":"备注信息哈4","name":"张4","sex":"女"},{"age":25,"birthday":"2012-02-22","demo":"备注信息哈5","name":"张5","sex":"女"},{"age":26,"birthday":"2012-02-22","demo":"备注信息哈6","name":"张6","sex":"女"},{"age":27,"birthday":"2012-02-22","demo":"备注信息哈7","name":"张7","sex":"女"},{"age":28,"birthday":"2012-02-22","demo":"备注信息哈8","name":"张8","sex":"男"},{"age":29,"birthday":"2012-02-22","demo":"备注信息哈9","name":"张9","sex":"男"},{"age":30,"birthday":"2012-02-22","demo":"备注信息哈10","name":"张10","sex":"女"},{"age":31,"birthday":"2012-02-22","demo":"备注信息哈11","name":"张11","sex":"男"},{"age":32,"birthday":"2012-02-22","demo":"备注信息哈12","name":"张12","sex":"男"},{"age":33,"birthday":"2012-02-22","demo":"备注信息哈13","name":"张13","sex":"男"},{"age":34,"birthday":"2012-02-22","demo":"备注信息哈14","name":"张14","sex":"女"}],"totalProperty":86}Ext.onReady(function(){
var reader=new Ext.data.JsonReader({
root: 'root',
totalProperty: 'totalProperty',
// the fields config option will internally create an Ext.data.Record
// constructor that provides mapping for reading the record data objects
fields: [
{name: 'name', mapping: 'name'},
{name: 'age', mapping: 'age', allowBlank: false},
{name: 'sex', mapping: 'sex'},
{name: 'birthday', mapping: 'birthday', type: 'date'},
{name: 'demo', mapping: 'demo'}
]
});
var store=new Ext.data.JsonStore({
root : 'list',
idProperty : 'name',
totalProperty:'totalProperty',
url:"GetStudentData",
fields: [
{name: 'name',type:"string", mapping: 'name'},
{name: 'age', type:"int",mapping: 'age', allowBlank: false},
{name: 'sex',type:"string", mapping: 'sex'},
{name: 'birthday', mapping: 'birthday', type: 'date'},
{name: 'demo', type:"string",mapping: 'demo'}
]
});
store.load({params:{start:0,limit:15}});
var grid = new Ext.grid.GridPanel({
store: store,
renderTo:Ext.getBody(),
colModel: new Ext.grid.ColumnModel({
defaults: {
width: 120,
sortable: true
},
columns:
[
{ id:"name",header: "name", width: 60, sortable: true,dataIndex:"name"},
{ header: "age", width: 150, sortable: true,dataIndex:"age"},
{ header: "sex", width: 100, sortable: true,dataIndex:"sex"},
{ header: "birthday", width: 100, sortable: true,dataIndex:"birthday",xtype:"datecolumn"},
{ header: "demo", width: 100, sortable: true,dataIndex:"demo"}
]
}),
viewConfig: {
forceFit: true,// Return CSS class to apply to rows depending upon data values
getRowClass: function(record, index) {
var c = record.get('age');
if (c < 0) {
return 'price-fall';
} else if (c > 0) {
return 'price-rise';
}
}
},
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
width: 600,
height: 300,
frame: true,
title: 'Framed with Row Selection and Horizontal Scrolling',
iconCls: 'icon-grid'
});
})
var reader=new Ext.data.JsonReader({
root: 'root',
totalProperty: 'totalProperty',
// the fields config option will internally create an Ext.data.Record
// constructor that provides mapping for reading the record data objects
fields: [
{name: 'name', mapping: 'name'},
{name: 'age', mapping: 'age', allowBlank: false},
{name: 'sex', mapping: 'sex'},
{name: 'birthday', mapping: 'birthday', type: 'date'},
{name: 'demo', mapping: 'demo'}
]
});
var store=new Ext.data.JsonStore({
root : 'list',
idProperty : 'name',
totalProperty:'totalProperty',
url:"GetStudentData",
fields: [
{name: 'name',type:"string", mapping: 'name'},
{name: 'age', type:"int",mapping: 'age', allowBlank: false},
{name: 'sex',type:"string", mapping: 'sex'},
{name: 'birthday', mapping: 'birthday', type: 'date'},
{name: 'demo', type:"string",mapping: 'demo'}
]
});
store.load({params:{start:0,limit:15}});
var grid = new Ext.grid.GridPanel({
store: store,
renderTo:Ext.getBody(),
colModel: new Ext.grid.ColumnModel({
defaults: {
width: 120,
sortable: true
},
columns:
[
{ id:"name",header: "name", width: 60, sortable: true,dataIndex:"name"},
{ header: "age", width: 150, sortable: true,dataIndex:"age"},
{ header: "sex", width: 100, sortable: true,dataIndex:"sex"},
{ header: "birthday", width: 100, sortable: true,dataIndex:"birthday",xtype:"datecolumn"},
{ header: "demo", width: 100, sortable: true,dataIndex:"demo"}
]
}),
viewConfig: {
forceFit: true,// Return CSS class to apply to rows depending upon data values
getRowClass: function(record, index) {
var c = record.get('age');
if (c < 0) {
return 'price-fall';
} else if (c > 0) {
return 'price-rise';
}
}
},
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
width: 600,
height: 300,
frame: true,
title: 'Framed with Row Selection and Horizontal Scrolling',
iconCls: 'icon-grid'
});
})
解决方案 »
- javascript求助
- 求助 :js文本编辑器插入flash的原理??
- 当select控件是disabled状态时,如何激活它的onmouseover事件?
- 怎样把数据追加到网页上?
- 如何实现点击某个div以外的区域,这个div消失?
- 请教JS分析二进制流的方法
- 连续按键卡顿
- 怎样把上个页面传过来的变量在另一个页面JavaScript语言某个函数中使用
- 动态web中调用<object>标签是如何动态修改标签里的属性值
- 用谷歌浏览器测试ev.wheelData怎么没有用了,求大家解答
- 在线急等,求解决,setTimeout执行的时候为什么会去执行其他方法的?
- 如何用JS动态在网页顶部插入一段<iframe>?
Ext.onReady(function(){
var reader=new Ext.data.JsonReader({
root: 'root',
totalProperty: 'totalProperty',
// the fields config option will internally create an Ext.data.Record
// constructor that provides mapping for reading the record data objects
fields: [
{name: 'name', mapping: 'name'},
{name: 'age', mapping: 'age', allowBlank: false},
{name: 'sex', mapping: 'sex'},
{name: 'birthday', mapping: 'birthday', type: 'date'},
{name: 'demo', mapping: 'demo'}
]
});
var store=new Ext.data.JsonStore({
root : 'root',
idProperty : 'name',
totalProperty:'totalProperty',
url:"GetStudentData",
fields: [
{name: 'name',type:"string", mapping: 'name'},
{name: 'age', type:"int",mapping: 'age', allowBlank: false},
{name: 'sex',type:"string", mapping: 'sex'},
{name: 'birthday', mapping: 'birthday', type: 'date'},
{name: 'demo', type:"string",mapping: 'demo'}
]
});
store.load({params:{start:0,limit:15}});
var grid = new Ext.grid.GridPanel({
store: store,
renderTo:Ext.getBody(),
colModel: new Ext.grid.ColumnModel({
defaults: {
width: 120,
sortable: true
},
columns:
[
{ id:"name",header: "name", width: 60, sortable: true,dataIndex:"name"},
{ header: "age", width: 150, sortable: true,dataIndex:"age"},
{ header: "sex", width: 100, sortable: true,dataIndex:"sex"},
{ header: "birthday", width: 100, sortable: true,dataIndex:"birthday",xtype:"datecolumn"},
{ header: "demo", width: 100, sortable: true,dataIndex:"demo"}
]
}),
viewConfig: {
forceFit: true,// Return CSS class to apply to rows depending upon data values
getRowClass: function(record, index) {
var c = record.get('age');
if (c < 0) {
return 'price-fall';
} else if (c > 0) {
return 'price-rise';
}
}
},
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
width: 600,
height: 300,
frame: true,
title: 'Framed with Row Selection and Horizontal Scrolling',
iconCls: 'icon-grid'
});
})
root : 'list', // 改成root:'root',
idProperty : 'name',
totalProperty:'totalProperty',
url:"GetStudentData",
fields: [
{name: 'name',type:"string", mapping: 'name'},
{name: 'age', type:"int",mapping: 'age', allowBlank: false},
{name: 'sex',type:"string", mapping: 'sex'},
{name: 'birthday', mapping: 'birthday', type: 'date'},
{name: 'demo', type:"string",mapping: 'demo'}
]
});