2012-11-08 109 views
0

我有下面的代碼在extjs中分頁...即使我將它設置爲每頁5條記錄,它仍然顯示6 ...和頁面1不顯示「 1「...我有來自sql Click here to go that Thread ....的數據的問題,所以我決定嘗試與內存存儲...但我仍然沒有得到分頁權....任何幫助?Extjs分頁工具欄與網格面板不工作

constructor: function() { 
    this.callParent(arguments); 
    var store = Ext.create('Ext.data.Store', { 
     pageSize: 5, 
     storeId: 'simpsonsStore', 
     fields: ['name', 'email', 'phone'], 
     data: { 
      'totalCount': "6", 
      'items': [{ 
       'name': 'Lisa', 
       "email": "[email protected]", 
       "phone": "555-111-1224" 
      }, { 
       'name': 'Bart', 
       "email": "[email protected]", 
       "phone": "555-222-1234" 
      }, { 
       'name': 'Homer', 
       "email": "[email protected]", 
       "phone": "555-222-1244" 
      }, { 
       'name': 'Marge', 
       "email": "[email protected]", 
       "phone": "555-222-1254" 
      }, { 
       'name': '29', 
       "email": "[email protected]", 
       "phone": "555-222-1254" 
      }, { 
       'name': '30', 
       "email": "[email protected]", 
       "phone": "555-222-1254" 
     }] 
    }, 
    proxy: { 
     type: 'memory', 
     reader: { 
      type: 'json', 
      root: 'items', 
      totalProperty: 'totalCount' 
     } 
    } 
}); 

this.grid = Ext.create('Ext.grid.Panel', { 
    title: 'Simpsons', 
    disableSelection: true, 
    loadMask: true, 
    stripeRows: true, 
    trackover: true, 
    renderTo: Ext.getBody(), 

    store: store, 
    columns: [{ 
     text: 'Name', 
     dataIndex: 'name' 
    }, { 
     text: 'Email', 
     dataIndex: 'email' 
    }, { 
     text: 'Phone', 
     dataIndex: 'phone' 
    }], 


    bbar: Ext.create('Ext.PagingToolbar', { 
     store: store, 
     displayInfo: true, 
     displayMsg: 'Displaying Surveys {0} - {1} of {2}', 
     emptyMsg: "No Surveys to display" 
    }) 


}); 
grid.loadPage(1); 
} 

} });

+0

嘗試爲數據添加一個id屬性。 –

回答