3.2.0

Disable sort feature

Is there a way to disable the sorting? I have a recordset that is returning about 500 records and it seems to freak out the browser (IE6.0) and if you look in taskmanager the CPU usage pegs out at 100%.

Thanks
Mike
Mike
June 24,
The easiest way is to remove mousedown event handler, which triggers sorting...
obj.getTemplate("top/item").setEvent("onmousedown", null);
Alex (ActiveWidgets)
June 24,
Is there a way to reassign the sort from the left mouse button to the right mouse button?? ( I would like to be able to reassign the onclick to a custom function and then use the oncontextmenu to initiate sort)
dean
July 20,
bump
Dean
July 22,

obj.sort(columnIndex, direction);


This works smooth. Why can't you pop a custom context menu and add the above code? Just an idea, never tested this one...

Check http://www.activewidgets.com/messages/1608-2.htm if you need more than one level of sorting

Sudhaker Raj
July 23,
And you can put your own event handler instead of the default one:

obj.getTemplate("top/item").setEvent("onmousedown", myEventFunction);
Alex (ActiveWidgets)
July 28,
Hi Alex.

By using your example ... how can I pass into myEventFunction, the column index? I need to resort the data on the server side so I'd like to capture the event of clicking on a header, then passing it (the column index) into the myEventFunction which will send the request back to the server.

Regards,
Brian Fredette
August 16,
I thing the event handler is generic event handler

Works in IE like this (you need to parse id to get column#)

function headerClicked(e) {
  alert(e.srcElement.id);
}
obj.getTemplate("top/item").setEvent("onmousedown", headerClicked);


In case of mozilla use 'e.target.id'

FYI: There might be better ways of doing it. hehe
Sudhaker Raj
August 16,
I have found the following code on the forums which I have working .... all about setting the url to the server. How do I do that?

var iCurrentSortIndex = 0;
var strCurrentSortDir = "";
var iCurrentPage = 1;
    
var SortFunction = function(src){

var iSortIndex = src.getProperty("item/index");
var strSortDir = src.getProperty("sort/direction");
        
if (iSortIndex != iCurrentSortIndex) { 
 strSortDir = "ascending"; 
} else if (strCurrentSortDir == "descending") { 
 strSortDir = "ascending"; 
} else { 
 strSortDir = "descending";
}
        
this.setProperty("sort/index", iSortIndex);
this.setProperty("sort/direction", strSortDir);
        
var strURL = "testing.php?blahblahblah";
//this.setURL(strURL); <---- both lines case object doesn't support
//this.request(); <--------- this property or method
        
iCurrentSortIndex = iSortIndex;
strCurrentSortDir = strSortDir;
};

obj.setAction("columnSort", SortFunction);


Thoughts?
Brian Fredette
August 16,
In the above posted code this refers to grid object.

So the code required will be something like this

........
this.setProperty("sort/index", iSortIndex); 
this.setProperty("sort/direction", strSortDir); 

var table = new Active.Text.Table;
table.setURL(strURL );
table.request();
this.setDataModel(table);

iCurrentSortIndex = iSortIndex; 
strCurrentSortDir = strSortDir; 
}; 

obj.setAction("columnSort", SortFunction); 
........


Don't forget to get this patch - http://thej2ee.com/x2/modules/newbb/viewtopic.php?topic_id=1&forum=4&post_id=1#forumpost1
Sudhaker Raj
August 16,
Use this function
// disable sort grid
obj.sort = function(index, direction){
return true;
}
FerdinandoGalera
August 28,
I am glad I can disable the sorting so painlessly. What I could not found so far is how to turn off the underlining of the column header. If you hover over the column header in the xp grid you get a orange underline. It does not make sense if the sorting is turned off.

Andreas
March 19,
change the graphic
Zach
July 2,
Is it possible to disable sorting on only one column header cell?
I'm trying to put a "check all" checkbox in the rightmost column header of the grid. The checkbox appears fine but when I try to click it the column resorts instead and the checkbox in the header remains unchecked.
Alternately, is there a way to force the checkbox to receive the focus of a click in a column header ?

I'm using version 1.

Thanks.
JJI
November 18,
try -- disable sorting on col 4
grid1.onHeaderClicked = function(event,index){
if (index==4) return 'disabled';
return "";
};


to restore initial sort
grid1.sort(""); // hide marker
grid1.setRowIndices("");

tony
November 20,
When attempting to disable the sort i get the following error:

//disable sort
obj.getTemplate("top/item").setEvent("onmousedown", null);

error:
this[get] has no properties

where is "top/item" set???

thanx
Elliott
July 25,

This topic is archived.

See also:


Back to support forum