Le nombre total de lignes s'affiche correctement dans la pagination, mais la pagination ne met pas à jour la vue lorsque vous cliquez sur le bouton suivant.La pagination ne met pas à jour la vue lorsque vous cliquez sur le bouton suivant
Je suis nouveau à Sencha. En Mysql, je retourne toutes les lignes. Alors que je peux limiter du côté client. Si je limite les lignes dans le backend, je ne peux pas avoir toutes les lignes du côté client.
Vue: List.js
/*** This view is an example list of people.
*/
Ext.define('CRUD.view.main.List', {
extend: 'Ext.grid.Panel',
xtype: 'home',
requires: [
'CRUD.store.Personnel'
],
title: 'Heroes',
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})
],
layout: 'fit',
fullscreen: true,
store: {
type: 'personnel',
},
columns: [
{ text: 'Name', dataIndex: 'name', sortable: true, flex: 1 },
{ text: 'Email', dataIndex: 'email', sortable: true, flex: 1 },
{ text: 'Phone', dataIndex: 'phone', sortable: true, flex: 1 }
],
bbar: {
store: {
type: 'personnel',
},
xtype: 'pagingtoolbar',
displayInfo: true
},
// columns: [
// { text: 'Name', dataIndex: 'name', flex: 1 },
// { text: 'Email', dataIndex: 'email', flex: 1 },
// { text: 'Phone', dataIndex: 'phone', flex: 1 }
// ],
listeners: {
select: 'onItemSelected',
},
});
magasin: Personnel.js
Ext.define('CRUD.store.Personnel', {
extend: 'Ext.data.Store',
alias: 'store.personnel',
model: 'CRUD.model.User',
id: 'list',
fields: [
'name', 'email', 'phone'
],
// data: [
// { name: 'Jean Luc', email: "[email protected]", phone: "555-111-1111" },
// { name: 'Worf', email: "[email protected]", phone: "555-222-2222" },
// { name: 'Deanna', email: "[email protected]", phone: "555-333-3333" },
// { name: 'Data', email: "[email protected]", phone: "555-444-4444" }
// ],
autoLoad: {
start: 0,
limit: itemsPerPage
},
buffered: true,
pageSize: itemsPerPage,
remoteSort: true,
proxy: {
type: 'jsonp', //cross domain calls - json parser
url: 'http://localhost:8080/list',
enablePaging: true,
reader: {
type: 'json',
totalProperty: 'total'
},
},
// proxy: {
// type: 'memory',
// reader: {
// type: 'json',
// }
// },
});
Merci pour votre réponse. En fait, il y a un problème de Cross Domain. Donc j'utilise JsonP. Ajax ne fonctionne pas pour la demande de domaine croisé. –