Javascript easyui数据网格样式器列
我有一个带有easyui的datagrid,我动态地创建头部,因为它们依赖于我的数据库。我的头球已经打对了。这是传递给datagrid的json对象Javascript easyui数据网格样式器列,javascript,json,datagrid,jquery-easyui,Javascript,Json,Datagrid,Jquery Easyui,我有一个带有easyui的datagrid,我动态地创建头部,因为它们依赖于我的数据库。我的头球已经打对了。这是传递给datagrid的json对象 [[ {"field": "status","title": "Estatus","align": "center","rowspan": "2"}, {"field": "Numero","title": "Orden","align": "center","rowspan": "2"}, {"field": "FechaRegist
[[
{"field": "status","title": "Estatus","align": "center","rowspan": "2"},
{"field": "Numero","title": "Orden","align": "center","rowspan": "2"},
{"field": "FechaRegistro","title": "Fecha","align": "center","rowspan": "2"},
{"field": "T1","title": "00:02:00","align": "center"},
{"field": "T2","title": "00:24:00","align": "center"},
{"field": "T3","title": "00:04:00","align": "center"},
{"field": "T4","title": "02:00:00","align": "center"},
{"field": "Cierre","title": "Fecha y Hora<br \/>de Cierre","align": "center","rowspan": "2"}
],[
{"field": "P1","title": "Informacion <br\/>tecnica para <br\/>aprobacion","align": "center","styler": "formatColor"},
{"field": "P2","title": "Aprobacion de<br\/> Informacion<br\/>Tecnica cliente","align": "center","styler": "formatColor"},
{"field": "P3","title": "Informacion<br\/>Tecnica de<br\/>Proceso","align": "center","styler": "formatColor"},
{"field": "P4","title": "Compra y<br\/>Recepcion de<br\/>Materiales","align": "center","styler": "formatColor"}
]]
但是我在我的控制台中得到了这个错误
Uncaught TypeError: col.styler is not a function
我的网格每秒都会被一个查询填充,在P1、P2、P3、P4列中有一些时间,T1、T2、T3、T4只是该列应该花费的确定时间。因此,我试图使,如果我的列值高于它将成为红色背景。我已经设法在小提琴上实现了这一点,问题是这里的标题不是动态加载的,这就是它不起作用的原因(从我所看到的)这里是小提琴
这就是我设置标题的方式
function RefreshHeaders(){
$.ajax({
url:"includes/getHeader.php",
cache: false,
timeout: 5000,
async: true,
success: function(data){
//console.log(data);
var objekJSON=jQuery.parseJSON(data);
$('#dg').datagrid({
fit:true,
fitColumns:false,
columns:objekJSON,
url:"includes/Get_Orders.php"
});
}
});
}
谢谢,能否提供更多代码,特别是关于getHeader.php的代码,以及如何将数据转换为JSON格式?在什么位置调用函数?
function RefreshHeaders(){
$.ajax({
url:"includes/getHeader.php",
cache: false,
timeout: 5000,
async: true,
success: function(data){
//console.log(data);
var objekJSON=jQuery.parseJSON(data);
$('#dg').datagrid({
fit:true,
fitColumns:false,
columns:objekJSON,
url:"includes/Get_Orders.php"
});
}
});
}