在easyui中用combogrid加载数据总是不成功,有没有遇到类是的问题的呢
代码 http://runjs.cn/detail/xukgvv5z
同样的数据 ,加载到表格上没有问题,加载到combogrid上却加载不了
var a = [{ code: 1, name: 'aaa', addr: 'aasdf', col4: 'asdfasdfasdf' },
{ code: 1, name: 'aaa', addr: 'aasdf', col4: 'asdfasdfasdf' },
{ code: 1, name: 'aaa', addr: 'aasdf', col4: 'asdfasdfasdf'}];
$("#userreg_middle_zcrj_tb").datagrid("loadData", a);
$("#cc").combogrid("loadData", a);
代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script id="jquery_183" type="text/javascript" class="library" src="/js/sandbox/jquery/jquery-1.8.3.min.js"></script> </head> <link id="others_jquery_easyui_131" rel="stylesheet" type="text/css" class="library" href="/js/sandbox/jquery-easyui/themes/default/easyui.css"> <script id="others_jquery_easyui_131" type="text/javascript" class="library" src="/js/sandbox/jquery-easyui/jquery.easyui.min.js"></script> <script type="text/javascript"> $(function () { $("#userreg_middle_zcrj_tb").datagrid({ width: 450, height: 250, rownumbers: true, columns: [[ { field: 'code', title: 'code', width: 100, editor: { type: 'combobox'} }, { field: 'name', title: 'name', width: 100, editor: { type: 'combobox'} }, { field: 'addr', title: 'addr', width: 100, editor: { type: 'text'} }, { field: 'col4', title: '', width: 50 } ]] }); $('#cc').combogrid({ panelWidth: 450, value: 'name', idField: 'code', textField: 'name', columns: [[{ field: 'code', title: 'Code', width: 60 }, { field: 'name', title: 'Name', width: 100 }, { field: 'addr', title: 'Address', width: 120 }, { field: 'col4', title: 'Col41', width: 100}]] }); var a = [{ code: 1, name: 'aaa', addr: 'aasdf', col4: 'asdfasdfasdf' }, { code: 1, name: 'aaa', addr: 'aasdf', col4: 'asdfasdfasdf' }, { code: 1, name: 'aaa', addr: 'aasdf', col4: 'asdfasdfasdf'}]; // var b = $.parseJSON(a); $("#userreg_middle_zcrj_tb").datagrid("loadData", a); $("#cc").combogrid("loadData", a); }); </script> <body> <table id="userreg_middle_zcrj_tb"></table> <input id="cc" name="dept" value="01"/> </body> </html>
$("#cc").combogrid("grid").datagrid("loadData", a);