View Full Version : grid column sorting causing multiple server hits

7 Aug 2007, 2:20 PM
I have a grid setup with column sorting and remoteSort:true set in the store (jsonReader). Each time I click on a column header to change the sorting, it makes 3 identical xhr calls.
Any ideas what I would check or debug? The code is too lengthy to post here, but I will post specific portions if needed.
It has no impact on the operation of my app, but obviously it could have a performance impact on the server.

7 Aug 2007, 4:41 PM
Posting a bit of your code would help.

Typically, this happens when your unknowingly adding a listener multiple times. I had this happen to me a while ago. At least I think thats what it was for me when this happened...Ill probably be able to spot it in your code.

7 Feb 2008, 12:44 PM
Hi, this post seems old but I have elements that may help someone to answer (yes, I'm facing the same problem in Ext-1.1.1).

In fact I have one grid on a page, which is ajax-injected into a div. Depending on the user choice, different grids may be injected. For ex., I may inject a Runway grid, then, onClick, replace it by another Airport grid. To allow my scripts to be generic, all grids have the same name (resultGrid).

Ext.get("searchResults").load ({
url: "/test/" + grid + "_grid.js",
callback: function() {
Each Grid is defined in a wrapper:

resultGrid = function() {

var ds, cm, columns, grid, paging;

return {

init : function () {

// create the Data Store

cm = new Ext.grid.ColumnModel(columns);

grid = new Ext.grid.Grid('searchResults', {

}, //init
destroy: function () {
render: function() {

load: function(params) {
getGrid: function() {
return grid;
getDataStore: function() {
return ds;
getColumnModel: function() {
return cm;

} // return

The fact is: the 1st time the 1st grid is displayed, clicking on a header fires 1 server request. But when the 2d grid is injected (and replaces the 1st One), clicking on a header fires 2 server requests, and so on...

Each time a new grid is loaded, I try to destroy the previous one:

But the problem remains.

I think that event handlers on the header cells are not 'released' when the grid is destroyed.

Anybody has an idea? Is there something wrong in the way we handle grids, or maybe there's a trick to unregister thoses listeners manually ?


7 Feb 2008, 1:03 PM
the grids gridView would need cleanup as well. That holds the events for column actions.

7 Feb 2008, 1:20 PM
I've also tried the following:

grid.events['headerclick'].clearListeners()without success.

BUT, interestingly enough: I was using the ext-jquery adapter and using the native ext-base adapter solved the problem.

In fact it turns out that somebody from our team has replaced the ext version of jQuery by a more recent one (1.2.1). Switching back to the original version solved the problem too.

This problem may be very specific but hope it may help.

Oh and thank Doug for trying to help me :-)