错误:Uncaught Error: jqxGrid: The data is still loading. When the data binding is completed, the Grid raises the 'bindingcomplete' event. Call this function in the 'bindingcomplete' event handler.
在调用jQuery UI Widgets的grid的时候,从数据库提取数据,发现一个很狗血的问题,
var columns = new Array();
var datafields = new Array();
var fileds = data.data;
if(fileds && fileds.length>0){
for(var key in fileds[0]){
//某字段的列宽,列名和对应的字段名
columns.push({text:key,datafield:key,align :'center',cellsalign : 'right'});
//字段名和数据类型
datafields.push({name:key});
}
var source = {
localdata: data.data,
datatype: "array",
datafields:datafields
};
}
var dataAdapter = new $.jqx.dataAdapter(source);
//加载数据,必须source在先,columns在后
this_.data_preview.jqxGrid({
source:dataAdapter,
columns: columns
});
必须source参数在前,不然就报错