2013-11-20 5 views
0

Extension Js에서 만든 다음 그리드가 있습니다. Json을 사용하여 그리드를 바인딩하고 있습니다. 일부 페이지 크기가 '10'이라고 말하면서 그리드에서 페이징을 활성화하려고하지만 페이징이 작동하지 않습니다. 여기 Extention JS Simple Grid에서 페이징을 사용하는 방법

내 코드는

,

Ext.onReady(function() { 
    var dataStore = new Ext.data.JsonStore({ 
     proxy: { 
      type: 'ajax', 
      url: 'Default.aspx/CustomerData', //'web.aspx', 
      headers: { 'Content-type': 'application/json' }, 
      reader: { 
       type: 'json', 
       root: 'd' 
      } 
     }, 
     fields: [ 
     { name: 'firstname', type: 'string' }, 
     { name: 'lastname', type: 'string' }, 
     { name: 'age', type: 'string' }, 
     { name: 'phone', type: 'string' } 
    ] 
    }); 

    dataStore.load(); 
    var myGrid1 = new Ext.grid.GridPanel({ 
     id: 'customerslist', 
     store: dataStore, 
     columns: [ 
     { id: "firstname", header: "First Name", width: 100, dataIndex: "firstname", sortable: true }, 
     { header: "Last Name", width: 100, dataIndex: "lastname", sortable: true }, 
     { header: "Age", width: 100, dataIndex: "age", sortable: true }, 
     { header: "Phone", width: 100, dataIndex: "phone", sortable: true } 
     ], 
     autoLoad: false, 
     stripeRows: true, 
     autoHeight: true, 
     width: 450, 
     height: 300, 
     dockedItems: [{ 
      xtype: 'pagingtoolbar', 
      store: dataStore, 
      dock: 'bottom', 
      displayInfo: true 
     }], 
     renderTo: 'grid1' 
    }); 
}); 

답변

2

시도 추가 pageSize가 10 점 속성에서

지금은 페이지 같아야한다 (10),이되지 페이징하지만 레코드 수를
var dataStore = new Ext.data.JsonStore({ 
     proxy: { 
      type: 'ajax', 
      url: 'Default.aspx/CustomerData', //'web.aspx', 
      headers: { 'Content-type': 'application/json' }, 
      reader: { 
       type: 'json', 
       root: 'd' 
      } 
     }, 
     fields: [ 
     { name: 'firstname', type: 'string' }, 
     { name: 'lastname', type: 'string' }, 
     { name: 'age', type: 'string' }, 
     { name: 'phone', type: 'string' } 
    ], 
     pageSize: 10 
    }); 
+0

크기. –

관련 문제