Seguro que es muy fácil, pero no se recoger los parámetros start y limit en las cargas a BD de un grid. La idea es paginar remotamente los datos, pero necesito pasarle al servidor algún parámetro para saber en que página estoy. Imagino que dichos parámetros serán el start y limit del load (y algún otro para saber el número de página que quiero visualizar). Sería tan sencillo como pasarle los parámetros en la llamada al servlet, o algo así...
¿Alguna idea? He traceado la request en el servlet y no me llega nada útil...
Básicamente estoy creando el grid (y se ve correctamente) con:
- Código: Seleccionar todo
Ext.onReady(function(){
// create the Data Store
var store = new Ext.data.Store({
// load using HTTP
url: 'http://localhost:8086/examples/servlets/servlet/GetStats',
// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have an "Item" tag
record: 'Item',
id: 'fechaLectura',
totalRecords: '@total'
}, [
// set up the fields mapping into the xml doc
// The first needs mapping, the others are very basic
{name: 'fechaLectura', mapping: 'ItemAttributes > fechaLectura'},
'os', 'navegador', 'resolucion','colores'
])
});
// creamos la barra
var pagingBar = new Ext.PagingToolbar({
pageSize: 25,
store: store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display",
items:[
'-', {
pressed: true,
enableToggle:true,
text: 'Show Preview',
cls: 'x-btn-text-icon details',
toggleHandler: function(btn, pressed){
var view = grid.getView();
view.showPreview = pressed;
view.refresh();
}
}]
});
// create the grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{header: "FechaLectura", width: 150, dataIndex: 'fechaLectura', sortable: true},
{header: "os", width: 450, dataIndex: 'os', sortable: true},
{header: "Navegador", width: 150, dataIndex: 'navegador', sortable: true},
{header: "Resolución", width: 150, dataIndex: 'resolucion', sortable: true},
{header: "Colores", width: 100, dataIndex: 'colores', sortable: true},
],
renderTo:'example-grid',
width:1004,
height:400,
// paging bar on the bottom
bbar: pagingBar,
});
store.load({params:{start:0, limit:25}});
});

