表格:自定义单元格;替换、颜色

时间:2022-01-27 08:59:49

监听处理"drawcell"事件

使用"drawcell"事件,可以自定义单元格内容、样式、行样式等。

详细参考:http://www.miniui.com/docs/tutorial/datagrid_drawcell.html


jQuery(document).ready(function() {
$.getJSON("Json/json.txt", function(server_data){
init(server_data);

});
});

function init(server_data){
mini.parse();

device = mini.get("device");
origin = mini.get("origin");
server_id = mini.get("server_id");

grid = mini.get("datagrid1");
grid.on("drawcell", function (e) {
var record = e.record,
column = e.column,
field = e.field,
value = e.value;

if (field == "server_id") {

$.each(server_data, function(k, v){
if (value == v.id){
e.cellHtml = v.text;
}

});

}

});
}