增强型网格默认仅显示 10 行?在道场



我的网格中有 100000 个数据,第一次请求它只显示 10 个,单击页面选择器后它显示下一个数据......请回答为什么增强网格第一次只显示 10 行

require([ "dojo/_base/lang","dojox/grid/EnhancedGrid",
          "dojox/grid/enhanced/plugins/Pagination","dojo/data/ItemFileReadStore",
          "dijit/form/Button","dojo/request/xhr", "dojo/dom",
          "dojo/dom-construct", "dojo/json", "dojo/on", "dojox/grid/cells/dijit",
          "dojo/domReady!" ],
    function(lang,EnhancedGrid,Pagination,ItemFileReadStore,Button,xhr, dom, domConst, JSON, on) {
            xhr("myservernameaddress/GridExample/string", {
                handleAs : "json"
            }).then(
                    function(dataa) {

                    /*  domConst.place("<p>response: <code>"
                                + JSON.stringify(dataa) + "</code></p>",
                                "output"); */
                                /* domConst.place("<p>response: <code>"
                                        + JSON.stringify(dataa) + "</code></p>",
                                        "output"); */
                        var mydata=dataa;
                         var yourStore = new dojo.data.ItemFileReadStore({
                                data: {
                                    identifier: "sno",
                                   /* items: mydata.aa */
                                   items:mydata
                                 }
                            });
                        grid = new EnhancedGrid({
                            store : yourStore,
                            selectable:true,
                            query : {
                                sno : "*"
                            },
                            structure : [  {
                                name : "SNO",
                                field : "sno",
                                width : "100px"
                            },{
                                name : "SNAME",
                                field : "sname",
                                width : "100px",
                                editable:true
                            },{
                                name : "SALARY",
                                field : "salary",
                                width : "200px",
                                editable:true
                            } ],
                            rowSelector: '20px',
                             plugins: {
                                pagination: {
                                    pageSizes: ["25","50","100"],
                                    description: true,
                                    sizeSwitch: true,
                                    pageStepper: true,
                                    gotoButton: true,
                                    maxPageStep: 2,
                                    position: "bottom",
                                    search:true
                                }
                            }
                        });
                        grid.placeAt("myGrid");
                        grid.startup();                 
                    }, function(err) {
                        alert("error");
                    }, function(evt) {
                    });
            });  

可以避免增强的网格默认 10 行大小,请检查一下

默认页面大小: 50,.

在分页插件中使用它...

我认为

这可能会对您有所帮助:定义网格时,可以设置自动高度

我从道场复制了这个:

自动高度

If true, automatically expand grid’s height to fit data. If numeric,
defines the maximum rows of data displayed (if the grid contains 
less than autoHeight rows, it will be shrunk).

欲了解更多信息,请查看:http://dojotoolkit.org/reference-guide/1.7/dojox/grid/DataGrid.html#datagrid-options

更新1

也许这个前一篇文章说得更清楚:DataGrid 的 rowsPerPage 属性不起作用

问候,米里亚姆

最新更新