Ext.grid.ColumnModel
[*]Ext.grid.ColumnModel([{
[*] id: 列的唯一标识,可以用于定义css,如:(.x-grid-td-topic b { color:#333 })
[*] header: 列的名称
[*] dataIndex: 在store中本列值的索引
[*] sortable: 设置本列是否支持排序
[*] renderer: 列值的渲染函数,定义函数如:function renderName(value, cellmeta, record, rowIndex, columnIndex, store){}
[*] width : 列宽
[*] hidden:true 是否隐藏本列
[*] }]);
[*]function renderDescn(value, cellmeta, record, rowIndex, columnIndex, store) {
[*] var str = "<input type='button' value='查看详细信息' onclick='alert(\"" +
[*] "这个单元格的值是:" + value + "\\n" +
[*] "这个单元格的配置是:{cellId:" + cellmeta.cellId + ",id:" + cellmeta.id + ",css:" + cellmeta.css + "}\\n" +
[*] "这个单元格对应行的record是:" + record + ",一行的数据都在里边\\n" +
[*] "这是第" + rowIndex + "行\\n" +
[*] "这是第" + columnIndex + "列\\n" +
[*] "这个表格对应的Ext.data.Store在这里:" + store + ",随便用吧。" +
[*] "\")'>";
[*] return str;
[*]}
[*]
[*]来看看我们可以在render里用到多少参数:
[*]
[*] 1.value是当前单元格的值
[*] 2.cellmeta里保存的是cellId单元格id,id不知道是干啥的,似乎是列号,css是这个单元格的css样式。
[*] 3.record是这行的所有数据,你想要什么,record.data["id"]这样就获得了。
[*] 4.rowIndex是行号,不是从头往下数的意思,而是计算了分页以后的结果。
[*] 5.columnIndex列号太简单了。
[*] 6.store,这个厉害,实际上这个是你构造表格时候传递的ds,也就是说表格里所有的数据,你都可以随便调用,唉,太厉害了。
页:
[1]