1

JQGrid ツリーグリッドを正しく展開できません。これは階層的な隣接グリッドです。

ルート ノードを展開すると、サブノードは正しく展開およびインデントされますが、ノードの直下には配置されません。

私のjsonデータに何か問題がありますか? 展開可能なノードが最初に表示され、リーフ ノードがその下に表示されるようにしたいと考えています。

例は次のとおりです: http://jsfiddle.net/yNw3C/3194/ (すべてのノードの名前を bob に変更しましたが、奇妙な展開動作がまだ見られます)

$(function () {

    var mydata = [{"id":"5a1a9743-3e0f-11d3-941f-006008032006","name":"bob","level":1,"parent":"5a1a9742-3e0f-11d3-941f-006008032006","isLeaf":true,"expanded":false,"loaded":true},{"id":"9042ded8-09ee-46f9-beac-8746ed1cdd17","name":"bob","level":1,"parent":"5a1a9742-3e0f-11d3-941f-006008032006","isLeaf":true,"expanded":false,"loaded":true},{"id":"29846baa-ede0-4582-b9ed-39bcc486f2c2","name":"bob","level":1,"parent":"5a1a9742-3e0f-11d3-941f-006008032006","isLeaf":false,"expanded":false,"loaded":true},{"id":"39cc2783-811f-4885-9af6-d35b1a1385a2","name":"bob","level":1,"parent":"5a1a9742-3e0f-11d3-941f-006008032006","isLeaf":true,"expanded":false,"loaded":true},{"id":"3061ce07-bff6-4d9a-a84a-a8a7d47ebd7a","name":"bob","level":1,"parent":"5a1a9742-3e0f-11d3-941f-006008032006","isLeaf":true,"expanded":false,"loaded":true},{"id":"d1f870ed-bca6-4cc8-8b96-b19fa251c2f8","name":"bob","level":1,"parent":"5a1a9742-3e0f-11d3-941f-006008032006","isLeaf":true,"expanded":false,"loaded":true},{"id":"5a1a9742-3e0f-11d3-941f-006008032006","name":"bob","level":0,"parent":null,"isLeaf":false,"expanded":false,"loaded":true},{"id":"c80ca2d1-8210-4c11-8c6d-005c97fce9cb","name":"bob","level":1,"parent":"5a1a9742-3e0f-11d3-941f-006008032006","isLeaf":true,"expanded":false,"loaded":true},{"id":"d9dadce8-a9ce-4343-a8a0-b80844aa36ad","name":"bob","level":1,"parent":"5a1a9742-3e0f-11d3-941f-006008032006","isLeaf":true,"expanded":false,"loaded":true},{"id":"b3bc918c-4fa6-4470-afdd-d98e3586d434","name":"bob","level":1,"parent":"5a1a9742-3e0f-11d3-941f-006008032006","isLeaf":false,"expanded":false,"loaded":true},{"id":"466d78df-6f39-43ff-abfd-58e7bf91f8c8","name":"bob","level":1,"parent":"5a1a9742-3e0f-11d3-941f-006008032006","isLeaf":true,"expanded":false,"loaded":true},{"id":"be4c23b9-41a2-482f-a37a-33379ea03344","name":"bob","level":1,"parent":"5a1a9742-3e0f-11d3-941f-006008032006","isLeaf":true,"expanded":false,"loaded":true}];                


    $("#treegrid").jqGrid({
    datatype: "jsonstring",
        datastr: mydata,
    colNames: ["id", "partners"],
    colModel: [
                { name: 'id', index: 'id', hidden: true, key: true },
                { name: 'name', index: 'name', width: 500, sortable: false, classes: 'pointer' },                       
    ],
    height: 'auto',
    gridview: true,
    rowNum: 10000,
    sortname: 'name',
    treeGrid: true,
    treeGridModel: 'adjacency',           
    ExpandColumn: 'name',
    jsonReader: {
        repeatitems: false,
        root: function (obj) { return obj; },
        page: function (obj) { return 1; },
        total: function (obj) { return 1; },
        records: function (obj) { return obj.length; }
    }
});        

});
4

2 に答える 2

0

現在、jqGrid はサーバーから返されたデータのみを処理できます。

http://www.trirand.com/jqgridwiki/doku.php?id=wiki%3atreegrid#options

JSON を返す単純な Web ページを作成します。

于 2013-07-01T10:26:06.667 に答える