cmの使い方
var cm = new Ext.grid.ColumnModel({
defaults: {
sortable: true // columns are not sortable by default
},
columns: [
{header:'NO.',renderer:function(value,cellmeta,record,rowIndex){return rowIndex+1;}},//
new Ext.grid.RowNumberer(),
{id: 'description',header: ' ',dataIndex: 'code'},
{header: ' ',dataIndex: 'shortName'},
{header: ' ',dataIndex: 'style',renderer:renderfun},
{header: ' ',dataIndex: 'unitName',width: 50},
{header:' ',dataIndex:'date',type:'date',renderer:Ext.util.Format.dateRenderer('Y m d ')},
{
header: ' ',
dataIndex: 'TASKSSTATUS',
renderer:function(value,cellmeta,record,rowIndex,columnIndex,store){
if(value==0){
return ' ';
}if(value==1){
return ' ';
}if(value==2){
return ' ';
}
},
editor:new fm.ComboBox({
typeAhead: true,//
triggerAction: 'all',
mode:'local',//
lazyRender: true,
listClass: 'x-combo-list-small',
store:new Ext.data.SimpleStore({
data:[[0,' '],[1,' '],[2,' ']],
fields:[{name:'sId',type:'int'},{name:'sName'}]
}),
valueField:'sId',
displayField:'sName'
})
}
]
});
function renderfun(value,cellmeta,record,rowIndex,columnIndex,store){
var str="<input type='button' value=' ' onclick='alert(\""+
" :"+value+"\
"+
" :{cellId:"+cellmeta.cellId+",id:"+cellmeta.id+",css:"+cellmeta.css+"}\
"+
" record :"+record+", \
"+
" "+rowIndex+" \
"+
" "+columnIndex+" \
"+
" Ext.data.Store :"+store+", 。"+
"\")'>";
return str;
}
var grid=new Ext.grid.GridPanel({
renderTo: 'editor-grid',
ds:ds,
cm:cm,
bbar:new Ext.PagingToolbar({//
pageSize:10,
store:ds,
displayInfo:true,
displayMsg:' {0} {1} , {2} ',
emptyMsg:" "
})
});
Ext.get('id').on('click',function(){
ds.remove(ds.getAt(1));
});
renderer:読めるすべてのパラメータ
メモ:recordはこの行のすべてのデータです.record.Data["id"]取得
rendererでは、カスタムパラメータを渡すこともできます.今回は見つからなかったので、次回補充しますO(∩∩)O~