首页 新闻 会员 周边 捐助

easyui中 combogrid控件的loadData方法加载不了数据,datagrid却可以?

0
悬赏园豆:20 [已关闭问题] 关闭于 2013-01-02 17:42

在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>
张巍的博客的主页 张巍的博客 | 菜鸟二级 | 园豆:230
提问于:2013-01-01 23:35
< >
分享
所有回答(1)
0

  $("#cc").combogrid("grid").datagrid("loadData", a);

张巍的博客 | 园豆:230 (菜鸟二级) | 2013-01-02 17:41
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册