PDA

View Full Version : Problem with a paging [URGENT]



geed64
2 Aug 2010, 10:33 PM
i'm trying to put a PagingToolbar to a grid but only show the first page of all the information, if somebody could helpme i'll appreciate

js


var local = false;
var storeP = new Ext.data.JsonStore({
// store configs
//autoDestroy: true,
url: (local ? url.local : url.remote),
storeId: 'myStore',
// reader configs
root: 'rs',
idProperty: 'id_vista',
totalProperty: 'totalCount',
baseParams: {
a: 'prueba'
},
sortInfo: {
field: 'id_vista',
direction: 'ASC'
},
fields: [
{
name: 'id_vista',
type: 'int',
mapping: 'ColRepId'
},
{
name: 'nombre_vista',
type: 'string',
mapping: 'nb_header'
}
]
});

var filters = new Ext.ux.grid.GridFilters({
// encode and local configuration options defined previously for easier reuse
encode: encode, // json encode the filter query
local: local, // defaults to false (remote filtering)
filters: [{
type: 'numeric',
dataIndex: 'id_vista'
}, {
type: 'string',
dataIndex: 'nombre_vista',
disabled: true
}]
});

var createColModel = function (finish, start) {

var columns = [{
dataIndex: 'id_vista',
header: 'id vista',
id: 'id_vista',
// instead of specifying filter config just specify filterable=true
// to use store's field's type property (if type property not
// explicitly specified in store config it will be 'auto' which
// GridFilters will assume to be 'StringFilter'
filterable: true,
filter: {type: 'numeric'}
}, {
dataIndex: 'nombre_vista',
header: 'Nombre Vista',
id: 'nombre_vista',
filter: {
type: 'string'
// specify disabled to disable the filter menu
//, disabled: true
}
}];

return new Ext.grid.ColumnModel({
columns: columns.slice(start || 0, finish),
defaults: {
sortable: true
}
});
};
storeP.load({
params: {
start: 0,
limit: 5
}
});
var gridP = new Ext.grid.GridPanel({
border: false,
store: storeP,
colModel: createColModel(2),
loadMask: true,
autoExpandColumn: 'nombre_vista',
stripeRows: true,
plugins: [filters],
bbar: new Ext.PagingToolbar({
store: storeP,
pageSize: 5,
displayInfo: true,
displayMsg: 'Mostrando los registros {0} al {1} de {2}',
emptyMsg: "Sin registros para mostrar",
plugins: [filters]
})
});


JSON



{"success":true,"totalCount":21, rs:[{"totalrs":"21","ColRepId":"1","nb_header":"Publicación"},{"totalrs":"21","ColRepId":"2","nb_header":"Distribuidor"},{"totalrs":"21","ColRepId":"3","nb_header":"Marca"},{"totalrs":"21","ColRepId":"4","nb_header":"No. de Parte"}]}


SQL



SET ROWCOUNT @LIMIT;

WITH RS AS(
SELECT @num_rows as totalrs, Row_number() OVER (ORDER BY PK_TWMED_ColumnasReportes) AS RowId,
PK_TWMED_ColumnasReportes AS ColRepId, nb_header
FROM TWMED_ColumnasReportes
)
SELECT totalrs, ColRepId, nb_header FROM RS WHERE RowId > @START

jay@moduscreate.com
5 Aug 2010, 7:01 AM
Marking your title with "URGENT" really turns people off. I suggest not doing it.

jay@moduscreate.com
5 Aug 2010, 7:02 AM
is your back-end accepting the start and limit params?!?

geed64
5 Aug 2010, 7:54 AM
it's work now, i didn't change anything. i don't know if it was the cache or something like that because suddenly works

But thanks!!

mschwartz
5 Aug 2010, 11:51 AM
Buy Ext JS In Action - it's URGENT!