PDA

View Full Version : Grid paginator



Snowman
26 Apr 2010, 6:03 AM
Hello !

I have test Ext.reg(' ... ');

In my example i have build 2 xtype's.
When i click on the paginator button the response is O.K. .
But the dataset don't change.

What is wrong ?

Your sincerly

snowman


Ext.namespace('App.TelefonlisteGrid','App.TelefonlisteStore');

App.TelefonlisteStore = Ext.extend(Ext.data.JsonStore, {
constructor: function(cfg) {
cfg = cfg || {};
App.TelefonlisteStore.superclass.constructor.call(this, Ext.apply({
storeId: 'telefonstore',
root: 'data',
autoLoad: true,
url: 'frontend/view/_telefonliste/telefonliste.php',
method: 'post',
baseParams: {
modul: 'telefonliste',
aktion: 'liste',
start: 0,
limit: 2
},
totalProperty: 'anzahl',
idProperty: 'id',
fields: [{
name: 'name',
mapping: 'name',
type: 'string'
},{
name: 'vorname',
mapping: 'vorname',
type: 'string'
},{
name: 'firma',
mapping: 'firma',
type: 'string'
},{
name: 'telefon1',
mapping: 'telefon1',
type: 'string'
},{
name: 'handy1',
mapping: 'handy1',
type: 'string'
},{
name: 'email',
mapping: 'email',
type: 'string'
}]
}, cfg));
}
});

Ext.reg('TelefonlisteStore',App.TelefonlisteStore);

App.TelefonlisteGrid = Ext.extend(Ext.grid.GridPanel, {
height: 336,
autoHeight: true,
autoExpandColumn: 'email',
stripeRows: true,
id: 'TelefonlisteGrid',

initComponent: function() {

this.columns = [{
xtype: 'gridcolumn',
header: 'Name',
sortable: true,
resizable: true,
width: 100,
dataIndex: 'name'
},{
xtype: 'gridcolumn',
header: 'Vorname',
sortable: true,
resizable: true,
width: 100,
dataIndex: 'vorname'
},{
xtype: 'gridcolumn',
header: 'Firma',
sortable: true,
resizable: true,
width: 150,
dataIndex: 'firma'
},{
xtype: 'gridcolumn',
header: 'Telefon',
sortable: true,
resizable: true,
width: 100,
dataIndex: 'telefon1'
},{
xtype: 'gridcolumn',
header: 'Handy',
sortable: true,
resizable: true,
width: 100,
dataIndex: 'handy1'
},{
xtype: 'gridcolumn',
header: 'Mail',
sortable: true,
resizable: true,
width: 100,
id: 'email',
dataIndex: 'email'
}];

this.store = {
xtype: 'TelefonlisteStore'
};

this.bbar = {
xtype: 'paging',
store: {
xtype: 'TelefonlisteStore'
},
pageSize: 2,
firstText: 'Anfang',
lastText: 'Ende',
emptyMsg: 'kein Ergebnis',
refreshText: 'neu laden',
displayInfo: true,
displayMsg: 'angezeigte Daten {0} - {1} von {2}',
};

this.sm = new Ext.grid.RowSelectionModel({
singleSelect: true
});

App.TelefonlisteGrid.superclass.initComponent.call(this);
}
});

Ext.reg('TelefonlisteGrid',App.TelefonlisteGrid);

Ext.namespace('App.Telefonliste');

App.Telefonliste = function(){

return{
init: function(){

var window = this.buildWindow;
window.add({
xtype: 'TelefonlisteGrid'
});

window.show();

return;
},

buildWindow: new Ext.Window({
width: 800,
title: 'Telefonliste',
id: 'telefonliste',
autoHeight: true,
y: 70,
closable: false,
draggable: false,
shadow: false,
layout: 'fit'
}),
}

}();

Ext.onReady(App.Telefonliste.init,App.Telefonliste);



I need an information.


Your sincerly

snowman

CrazyEnigma
26 Apr 2010, 8:48 PM
This might help you:
Paginators do not like any stores other than Store. Use a specific reader to read JSON, XML, Arrays.

If the rest of your code is right, then this should solve the problem.