2012-05-10 14 views
0

私は以下のコードを使用しています。私はグリッドを参照して、コンテンツは正しいが、ページャのセクションは奇妙です。ExtJS:ページングが機能していません。リフレッシュボタン

  1. 「次へ」、「前へ」などのボタンは有効になっていません。 4つのレコードがあり、ページごとに3つのレコードを尋ねると、「ページ1/2」が表示されます。
  2. 「更新」ボタンを管理するにはどうすればよいですか。

enter image description here

おかげで、

$(document).ready(function() { 

     Ext.define('User', { 
      extend: 'Ext.data.Model', 
      fields: [ 
      { name: 'FirstName', type: 'string' }, 
      { name: 'LastName', type: 'string' }, 
      { name: 'Email', type: 'string' } 
     ] 
     }) 

     var userStore = Ext.create('Ext.data.Store', { 
      model: 'User', 
      proxy: { 
       type: 'ajax', 
       url: '/Home/GetUsers', 
       reader: { 
        type: 'json', 
        root: 'users' 
       } 
      }, 
      autoLoad: true 
     }); 


     Ext.create('Ext.grid.Panel', { 
      renderTo: 'testing', 
      store: userStore, 
      autoScroll: true, 
      layout: 'fit', 
      title: 'Users', 
      width:450, 
      columns: [{ 
       text: 'First Name', 
       width: 225, 
       sortable: true, 
       dataIndex: 'FirstName', 
       editor: { 
        xtype: 'textfield', 
        allowBlank: false 
       } 
      }, 
      { 
       text: 'Last Name', 
       width: 225, 
       sortable: true, 
       dataIndex: 'LastName', 
       editor: { 
        xtype: 'textfield', 
        allowBlank: false 
       } 
      }], 
      bbar : Ext.create('Ext.toolbar.Paging', { 
       store: userStore, 
       pageSize: 3, 
       displayInfo: true, 
       displayMsg: 'Displaying topics {0} - {1} of {2}', 
       emptyMsg: "No topics to display" 
      }) 

     }); 

    }); 

アップデート1:

{"total":2,"success":true,"data":[{"Id":1,"FirstName":"AA","LastName":"BB"},{"Id":2,"FirstName":"CC","LastName":"DD"},{},{}]} 

私はまだ「私はドン

答えて

0

http://jsfiddle.net/AnYeq/1/ "2のページX" を参照してくださいしないでくださいcと何か間違って見ないあなたのページテキスト。 "total"プロパティのないテストjsonデータでも。 リフレッシュボタンを制御することはそれほど明白ではありません。 Ext.toolbar.Pagingを拡張し、プライベートメソッドgetPagingItemsを上書きしようとすることができます。

+0

ページ番号はjsfiddleと同じコードで空ですが、私はExtJS 4.1を使用しています –

+0

このコードをjsfiddleに貼り付ける前に、私自身のJSONデータプロバイダでExt 4.1のローカルWebサーバーでテストしました。 –

+0

私の更新が追加されましたJSON –

関連する問題