jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Paging problem while filtering enabled
Tagged: grid, virtual mode
This topic contains 4 replies, has 2 voices, and was last updated by Peter Stoev 12 years, 10 months ago.
-
Author
-
My grid is bound via jqxDataAdapter to remote data (asp.net web api).
If filtering is disabled, paging works, but if filtering is enabled when
I go to next page an exception occurs in jqxgrid.filter.js, at instructionvar b=this.dataview.cachedrecords[0][d.datafield]
because this.dataview.cachedrecords goes from index 10 to 19, while cachedrecords[0]
is undefined.What am I doing wrong?
Below a portion of my code:
var StreetsView = Backbone.View.extend({
el: $(“#streetsContainer”),initialize: function () {
this.pageNum = 0;
var self = this;
// prepare the data
var source =
{
datatype: “json”,
datafields: [
{ name: ‘StreetName’ },
{ name: ‘DistrictName’ }
],
url: “api/map”,
root: ‘Streets’,
beforeprocessing: function (data) {
this.totalrecords = data.Count;
self.collection = data.Streets;
}
};var dataAdapter = new $.jqx.dataAdapter(source);
$(“#streetsGrid”).jqxGrid(
{
width: 720,
height: 305,
pageable: true,
filterable: true,
source: dataAdapter,
virtualmode: true,
rendergridrows: function () {
return dataAdapter.records;
},
columns: [
{ text: ‘Street name’, datafield: ‘StreetName’, width: 450 },
{ text: ‘District Name’, datafield: ‘DistrictName’, width: 270 }
]
});this.render();
},…
Hi and.b,
As far as I see, you use the Grid in virtual mode with Server Side paging. In that mode, if you want to filter the Grid’s data, you need to implement Server Side filtering, too.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
the exception problem is signaled only if I debug my application from Visual Studio 2010; if I load the page from the browser without passing through VS, when I click on next page arrow the grid doesn’t update.
It is strange because the http request e relative response is always the same, both with filter disabled or enabled:Request GET /api/map?filterscount=0&groupscount=0&pagenum=1&pagesize=10 HTTP/1.1
Response body {“Count”:1001,”Streets”:[{“DistrictName”:”TAVAGNACCO”,”Id”:10,”StreetName”:”ALZAIA NAVIGLIO PAVESE _MILANO”},{“DistrictName”:”UDINE”,”Id”:43,”StreetName”:”AUTOSTRADA DEI LAGHI _ARESE”},{“DistrictName”:”TAVAGNACCO”,”Id”:44,”StreetName”:”AUTOSTRADA DEI LAGHI _BARANZATE”},{“DistrictName”:”UDINE”,”Id”:45,”StreetName”:”AUTOSTRADA DEI LAGHI _CERRO-MAGGIORE”},{“DistrictName”:”TAVAGNACCO”,”Id”:46,”StreetName”:”AUTOSTRADA DEI LAGHI _LAINATE”},{“DistrictName”:”UDINE”,”Id”:47,”StreetName”:”AUTOSTRADA DEI LAGHI _LEGNANO”},{“DistrictName”:”TAVAGNACCO”,”Id”:48,”StreetName”:”AUTOSTRADA DEI LAGHI _MILANO”},{“DistrictName”:”UDINE”,”Id”:49,”StreetName”:”AUTOSTRADA DEI LAGHI _RHO”},{“DistrictName”:”TAVAGNACCO”,”Id”:50,”StreetName”:”AUTOSTRADA DEL SOLE _CERRO-AL-LAMBRO”},{“DistrictName”:”UDINE”,”Id”:51,”StreetName”:”AUTOSTRADA DEL SOLE _MELEGNANO”}]}
And if filterscount is 0 (because I’ve not set any value in the filter text box), it seems to me reasonable: I mustn’t apply any filter in the server.
Bye
Hi Peter,
my previous reply had some language errors, read this (sorry):
The exception problem is signaled only if I debug my application from Visual Studio 2010; if I load the page from the browser without passing through VS, when I click on next page arrow the grid doesn’t update.
It is strange because the http request and relative response are always the same, both with filter disabled or enabled:Request GET /api/map?filterscount=0&groupscount=0&pagenum=1&pagesize=10 HTTP/1.1
Response body {“Count”:1001,”Streets”:[{“DistrictName”:”TAVAGNACCO”,”Id”:10,”StreetName”:”ALZAIA NAVIGLIO PAVESE _MILANO”},{“DistrictName”:”UDINE”,”Id”:43,”StreetName”:”AUTOSTRADA DEI LAGHI _ARESE”},{“DistrictName”:”TAVAGNACCO”,”Id”:44,”StreetName”:”AUTOSTRADA DEI LAGHI _BARANZATE”},{“DistrictName”:”UDINE”,”Id”:45,”StreetName”:”AUTOSTRADA DEI LAGHI _CERRO-MAGGIORE”},{“DistrictName”:”TAVAGNACCO”,”Id”:46,”StreetName”:”AUTOSTRADA DEI LAGHI _LAINATE”},{“DistrictName”:”UDINE”,”Id”:47,”StreetName”:”AUTOSTRADA DEI LAGHI _LEGNANO”},{“DistrictName”:”TAVAGNACCO”,”Id”:48,”StreetName”:”AUTOSTRADA DEI LAGHI _MILANO”},{“DistrictName”:”UDINE”,”Id”:49,”StreetName”:”AUTOSTRADA DEI LAGHI _RHO”},{“DistrictName”:”TAVAGNACCO”,”Id”:50,”StreetName”:”AUTOSTRADA DEL SOLE _CERRO-AL-LAMBRO”},{“DistrictName”:”UDINE”,”Id”:51,”StreetName”:”AUTOSTRADA DEL SOLE _MELEGNANO”}]}And if filterscount is 0 (because I’ve not set any value in the filter text box), it seems to me reasonable: I mustn’t apply any filter in the server.
Bye
Hi and.b,
Please, take a look at this help topic which shows how to implement server side paging and filtering: php-server-side-grid-paging-and-filtering.htm.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.