数据如下:{"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'
});
})
解决方案 »
- 这样的缓动效果的公式算法怎么计算的 ?小弟一直很困惑.
- sencha的list组件,可否在分组后做成折叠面板的效果?
- 请问onlick该加载哪? 谢谢
- --------------------------这段代码 哪错了????
- Ext xtype问题
- 老得不是再老的问题
- 能否在主框架页面中调用子框架页面的js函数?
- 如何替换页面中<script></script>之间的内容
- 在JavaScript怎么把...getTime()的道德时间转换成yyyy-mm-dd的格式呢?(在线等待)
- 这段代码错在哪里?
- 在线急等,求解决,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'}
]
});