1

我正在使用 extjs 进行分页网格,但在页面加载时它一次显示我的所有数据......但我将 pagesize 设置为 15 这是我的代码

    Ext.require(['Ext.grid.*',
                     'Ext.data.*',
                     'Ext.util.*',
                     'Ext.toolbar.Paging']);            
            Ext.onReady(function () {       

                var storedata=new Ext.data.Store(    {
                    pageSize: 15, 
                    autoLoad: true,
                    fields:[
                            {name: 'dimEAColumn'},
                            {name: 'dimEntitytable'},            
                            {name: 'dimtableName'}, 
                            {name: 'is_scan_enabled'},
                            {name: 'name'},
                            {name: 'scanType'},
                            {name: 'severity'}

                        ],
                     proxy: {
                         type: 'rest',
                          url : 'data/grid1.json',
                            reader: {
                                type: 'json',
                                root: 'CompositionDAO'

                                }
                        },

               });  

                storedata.load();

            // create the grid
            var grid = new Ext.grid.GridPanel({
                store: storedata,


                columns: [
                    {header: "Severity", width: 70,dataIndex: 'severity', sortable: true},
                    {header: "Scan Name", width: 275, dataIndex: 'name', sortable: true},
                    {header: "Status", dataIndex: 'is_scan_enabled', sortable: true},
                    {header: "Master Data Dimension",width:130, dataIndex: 'scanType', sortable: true},
                    {header: "Entity",  dataIndex: 'dimEntitytable', sortable: true },
                    {header: "Attribute",dataIndex: 'scanType', sortable: true}

                ],

                // paging bar on the bottom
                bbar: Ext.create('Ext.PagingToolbar', {
                    store: storedata,
                    displayInfo: true,
                    displayMsg: 'Displaying topics {0} - {1} of {2}',
                    emptyMsg: "No topics to display",

                }),
                renderTo:'QualityScans',
                width:797,
                height:200,
                loadMask: true,
                viewConfig: {emptyText: '<span style="position:absolute; margin-left:300px; font-size:12px; top:50px;color:#004669;font-weight:bold;">No data to display</span>'}
            });
            });

这是我的 json 数据

{
"CompositionDAO": [
    {
        "dimEAColumn": "F_BIRTHDATE_VALUE",
        "dimEntitytable": "PERSON",
        "dimtableName": "PERSONDM",
        "is_scan_enabled": 1,
        "name": "Invalid Birth Dateeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        "scanType": "Quality",
        "severity": "High"
    },
    {
        "dimEAColumn": "F_GIVEN_NAME_ONE",
        "dimEntitytable": "PERSONNAME",
        "dimtableName": "PERSONDM",
        "is_scan_enabled": 1,
        "name": "Company Stored as Person (Given Name)",
        "scanType": "Quality",
        "severity": "High"
    },
    {
        "dimEAColumn": "F_GIVEN_NAME_ONE",
        "dimEntitytable": "PERSONNAME",
        "dimtableName": "PERSONDM",
        "is_scan_enabled": 0,
        "name": "Given Name One Anonymous Value",
        "scanType": "Quality",
        "severity": "High"
    }, and so on

请告诉我会有什么问题

4

1 回答 1

1

请检查您的 json 响应。您缺少总数 您的回复应类似于 { totalCount":"255", "CompositionDAO":[ {your data}]

它会帮助你

于 2013-04-22T06:20:31.103 回答