我对剑道网格和自定义模板有疑问。问题是,我需要检查列的值
- 如果 Value == 1,我需要将其更改为 Icon Check
- 如果 Value == 0,我需要将其更改为 Icon Delete
- 如果值 == -1。我需要返回空的html
这是示例代码:小提琴
var myFields = {
no: { },
section: { },
service: { }
};
for(var x = 0 ; x < dataList.length; x++){
myFields["data"+x] = { };
}
var no = 0;
var myColumns = [
{ title: "No", locked: true, width: 50, template: function(e){return ++no; } },
{ field: "section", title: "Hole Section", locked: true, width: 130 },
{ field: "service", title: "Services", locked: true, width: 200 }
/* other columns ... */
];
for(var x = 0 ; x < dataList.length; x++){
myColumns.push( { field: "data"+x, title: dataList[x], width: 100, locked: false});
}