0

extjs4.1を使用してグリッドにページングツールバーを実装しています。最初のページのレコードが20セット取得されます。「しかし」「次へ」をクリックしても、次のページが表示されません。問題はここにあると思います

proxy: {
            type: 'ajax',
            scope: this,
            url: 'Controller/getData',
            extraParams: {
                PageNumber: this.currentPage, // this doesn't change on clicking next
                PageSize: 20

            },
            reader: {
                type: 'json',
                root: 'myTable',
                totalProperty: 'count'
            }

ご覧のとおり、コントローラーに渡すPageNumberは静的です。そのページを取得する番号に変更すると、現在のページを取得してコントローラーに渡すことができます。以下は私のツールバーです

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

助けてください...ありがとう

4

1 に答える 1

1

私があなたを助けることができるかどうかわかりません、あなたはあなたのバックエンド処理コードをチェックしましたか?つまり、私が知る限り、ストアとページングツールバーを宣言する方法は正しいので、サーバー側に問題がある可能性があります。

参考までに、これはページングをサポートするストアを処理するためのサーバー側のページ(remote / data / user / mahasiswa / read.php)です。

$sql = "SELECT * FROM user";
$rs = mysql_query($sql);
$totalCount = mysql_num_rows($rs);
$sql = $sql." LIMIT ".$start.",".$limit;
$rs = mysql_query($sql);
while($obj = mysql_fetch_object($rs)){
    $arr[] = $obj;
}
echo '{success:true, totalCount:'.$totalCount.', data:'.json_encode($arr).'}';

次に、これは私の店です:

Ext.define('PMK.store.user.Mahasiswa', {
extend: 'Ext.data.Store',
model: 'PMK.model.user.Mahasiswa',
pageSize: 30,

proxy: {
    type: 'ajax',
    url: 'remote/data/user/mahasiswa/read.php',
    reader: {
        type: 'json',
        root: 'data',
        successProperty: 'success',
        totalProperty: 'totalCount'
    }
})

最後にこれは私の見解です:

Ext.define('PMK.view.user.mahasiswa.List' ,{
extend: 'Ext.panel.Panel',
alias : 'widget.mhslist',

title:'Manage Mahasiswa',
layout:'fit',

initComponent: function() {
    this.items = [
        {
            xtype:'grid',
            store:'user.Mahasiswa',
            columns: [
                {xtype: 'rownumberer', width: 50, sortable: false},
                {header: 'Angkatan', dataIndex: 'ANGKATAN', sortable:true, width:60},
                {header: 'NIM', dataIndex: 'NIM', sortable:true, width:100},
                {header: 'Nama', dataIndex: 'NAMA', sortable:true, width:225},
                {header: 'Program Studi', dataIndex: 'PRODI', sortable:true, width:225},
                {header: 'Kelas', dataIndex: 'KELAS', sortable:true, width:50},
                {header: 'Dosen PA', dataIndex: 'DOSEN_PA', sortable:true, width:125},
                {header: 'Jalur', dataIndex: 'JALUR', sortable:true, width:50},
                {header: 'Asal Sekolah', dataIndex: 'ASAL_SEKOLAH', sortable:true, width:175},
                {header: 'Tempat Lahir', dataIndex: 'TL', sortable:true, width:100},
                {header: 'Tanggal Lahir', dataIndex: 'TGL', sortable:true, width:75},
                {header: 'JK', dataIndex: 'JK', sortable:true, width:25},
                {header: 'Alamat', dataIndex: 'ALAMAT', sortable:true, width:225},
                {header: 'Email', dataIndex: 'EMAIL', sortable:true, width:130},
                {header: 'Telp', dataIndex: 'TELP', sortable:true, width:100},
                {header: 'Agama', dataIndex: 'AGAMA', sortable:true, width:50},
                {header: 'Input Date', dataIndex: 'INPUT_DATE', sortable:true, width:125},
                {header: 'Input By', dataIndex: 'INPUT_BY', sortable:true, width:125},
                {header: 'Edit Date', dataIndex: 'EDIT_DATE', sortable:true, width:125},
                {header: 'Edit By', dataIndex: 'EDIT_BY', sortable:true, width:125}
            ]
        }
    ];

    this.bbar = Ext.create('Ext.PagingToolbar', {
        store: 'user.Mahasiswa',
        displayInfo: true,
        displayMsg: 'Displaying mahasiswa {0} - {1} of {2}',
        emptyMsg: "No mahasiswa to display"
    });

    this.callParent(arguments);
}
});
于 2012-11-21T02:47:59.190 に答える