-1

我的网格中有 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) {

                    });

            });  
4

2 回答 2

1

可以避免增强网格默认10行大小请检查它

默认页面大小:50,。

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

于 2013-10-03T06:26:39.470 回答
0

我认为这可能会对您有所帮助:当您定义网格时,您可以设置 autoHeight

我从dojo复制了这个:

自动高度

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 属性不起作用

问候,米里亚姆

于 2013-09-17T10:16:49.170 回答