【问题标题】:Store option not working dgrid, works perfect with ondemandgrid存储选项不工作 dgrid,与 ondemandgrid 完美配合
【发布时间】:2014-05-13 20:47:26
【问题描述】:

我想使用 Dgrid 的 store 属性,我正在使用下面的代码来制作 dgrid 表,但不知何故,表中没有填充行。

 <script src="dojo/dojo.js"
            data-dojo-config="async: true"></script>
   <script>
        require(["dojo/_base/declare","dgrid/Grid","dgrid/Keyboard","dgrid/Selection","dgrid/editor","dgrid/extensions/DnD","dojo/dnd/Source", "dojo/store/Memory", "dojo/_base/lang"],
                function (declare,Grid,Keyboard,Selection,editor,DnD, DnDSource, Memory, lang){
                    var store = new Memory({
                        data: [
                            { id: 1, firstName: "Jeffrey", lastName: "Andrews", email: "jeffrey@madeupdomain.com" },
                            { id: 2, firstName: "Jenny", lastName: "Saunders", email: "jenny@madeupdomain.com" },
                        ]
                    });
                    var structure = [
                        {field: "lastName", label: "Last Name"},
                        {field: "firstName", label: "First Name"},
                        {field: "email", label: "EMail Address"}
                    ];

                    var grid = new (declare([Grid, Selection, DnD]))({
                                store: store,
                                columns: structure
                            },
                            "gridtable");
                    grid.startup();
                });

    </script>
</head>

<div id="gridtable"></div>

【问题讨论】:

    标签: dojo dgrid


    【解决方案1】:

    基本的ListGrid 模块不是为存储感知而设计的。存储感知通常继承自 _StoreMixinOnDemandListPagination 扩展继承。

    自己做_StoreMixin的扩展也是可行的;例如,dgrid.io 上的一个教程会遍历 very simple extension to render all data from a store at once

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-31
      相关资源
      最近更新 更多