[b]TreeGrid:绘制单元格[/b]
[url=http://www.miniui.com/demo/treegrid/drawcell.html][img]http://www.miniui.com/docs/api/images/treegrid_drawcell.png[/img][/url]
参考示例: [url=http://www.miniui.com/demo/treegrid/drawcell.html]TreeGrid:绘制单元格[/url]
[b]监听处理"drawcell"事件[/b]
使用"drawcell"事件,可以自定义单元格内容、样式、行样式等。
function onDrawCell(e){
var node = e.node,
column = e.column,
field = e.field,
value = e.value;
//格式化日期
if (field == "Finish") {
if (mini.isDate(value)) e.cellHtml = mini.formatDate(value, "yyyy年MM月dd日");
}
//工期
if (field == "Duration") {
e.cellHtml = value + "天";
}
//进度
if (field == "PercentComplete") {
e.cellHtml = '<div class="progressbar">'
+ '<div class="progressbar-percent" style="width:' + value + '%;"></div>'
+ '<div class="progressbar-label">' + value + '%</div>'
+'</div>';
}
};
[url=http://www.miniui.com/demo/treegrid/drawcell.html][img]http://www.miniui.com/docs/api/images/treegrid_drawcell.png[/img][/url]
参考示例: [url=http://www.miniui.com/demo/treegrid/drawcell.html]TreeGrid:绘制单元格[/url]
[b]监听处理"drawcell"事件[/b]
使用"drawcell"事件,可以自定义单元格内容、样式、行样式等。
function onDrawCell(e){
var node = e.node,
column = e.column,
field = e.field,
value = e.value;
//格式化日期
if (field == "Finish") {
if (mini.isDate(value)) e.cellHtml = mini.formatDate(value, "yyyy年MM月dd日");
}
//工期
if (field == "Duration") {
e.cellHtml = value + "天";
}
//进度
if (field == "PercentComplete") {
e.cellHtml = '<div class="progressbar">'
+ '<div class="progressbar-percent" style="width:' + value + '%;"></div>'
+ '<div class="progressbar-label">' + value + '%</div>'
+'</div>';
}
};