1、步骤
1.1 步骤一 定义数据(Data Definition)
单行的XML样本数据
1.2步骤二 列模型(Column Model)
列模型样本
进行渲染!
2、注意
2.1 因为这些数据是异步加载的,所以必须放在服务器上,进行浏览;如果没有放在服务器上,这些数据是不能进行加载的 .
2.2 出现了“ext-lang-zh_CN.js 未结束的字符串常量” 错误:
在eclipse里面单独设置ext-lang-zh_CN.js的属性---编码格式为utf-8,然后去掉js里面的所有空格,问题解决
关于分页有个默认属性,默认是每页20条数据,不记得在那里了
3、code
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
Code
// create the grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{header: "Author", width: 120, dataIndex: 'Author', sortable: true},
{header: "Title", width: 180, dataIndex: 'Title', sortable: true},
{header: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true},
{header: "Product Group", width: 100, dataIndex: 'ProductGroup', sortable: true}
],
renderTo:'example-grid',
width:540,
height:300,
//可以设置tbar:在datagrid上面显示(上一页,下一页等)
bbar:new Ext.PagingToolbar(
{
pageSize:10,
store: store,
displayInfo:true//这个属性加上了之后,就可以显示数据信息,从多少条到多少条,共多少条
})
});