将jqxGrid与深json输出绑定

时间:2014-03-03 06:59:48

标签: jqxgrid

    <script type="text/javascript">
        $(document).ready(function () {

            var data1=[{"Employees": {"Employee": [{ "EmpID": "Beverly  Hills","EmpSubject": 90210},{ "EmpID": "Beverly Hills1","EmpSubject": 90210333}]}}];

            var source =
            {
                datatype: "json",
                  datafields: [
                    {name: 'subject', map: 'Employees>Employee>EmpSubject'},
                    {name: 'empid', map: 'Employees>Employee>EmpID'}

                ],
               localdata:data1
            };
            var dataAdapter = new $.jqx.dataAdapter(source, {
                downloadComplete: function (data, status, xhr) { },
                loadComplete: function (data) { },
                loadError: function (xhr, status, error) { }
            });
            $("#jqxgrid").jqxGrid(
            {
                width: 1435,
                source: dataAdapter,
                pageable: true,
                autoheight: true,
                sortable: true,
                altrows: true,
                enabletooltips: true,
                editable: true,
                selectionmode: 'multiplecellsadvanced',
                columns: [

                 { text: 'Subject', datafield: 'subject'},
                 { text: 'ID', datafield: 'empid'}


                ],

            });
        });
    </script>
  

这里我想显示两个员工的详细信息(即两行)。但是jqxgrid不是&gt;显示记录。请帮忙。

     

最诚挚的问候   巴拉

1 个答案:

答案 0 :(得分:0)