:: Forum >>

Disable sort in some columns

Hello!
I want to disable the sort feature for hiperlink and image columns, but I want to keep this feature for the rest of the cols in the grid.
anyone knows how to do that?
Thanks!
Sergio
Tuesday, September 7, 2004
You can override sort function:

var _sort = obj.sort;

    obj.sort = function(index, direction){
        if (index == 1){
            return;
        }
        else {
            _sort.call(this, index, direction);
        }
    }
Alex (ActiveWidgets)
Tuesday, September 7, 2004
Doesn't work :(
my code:
var _sort = obj.sort;

obj.sort = function(index, direction){
if (index == 5 && index == 6){
return true;
}
else {
_sort.call(this, index, direction);
}
}


the 5 & 6 columns contains images.
Sergio
Wednesday, September 8, 2004
sorry, I should use || intead of && ....
It's working fine!!!
Thanks!
Sergio
Wednesday, September 8, 2004
The code can disable the sorting, but if I click the column header, it still hold for a while before released. There is also a message "Sorting..." in the status bar.

Can these sorting behaviour be totally removed too? If I click the column header, it has no response, the header is not "pressed down" as well. How can I do that?
Henry Ng
Tuesday, September 14, 2004
I have this problem also. Is there a solution for this?
Ben
Friday, January 27, 2006
I might have a solution for this problem, but there is still a problem.
This function disables the column header. You can not click it or the "mouseover" efect wil not work. But when you sort an other column, the activewidget will be refreshed and the handlers wil be reset. This means that the column is re-enabled... Maybe someone finds a solution for this... and if not, it was worth a try :)

//index = the column index
function disableSort(index) {
//objectName = the name that you use for the activewidget object
var id = objectName+'.top.item:'+index;
el = document.getElementById(id);
el.removeEventListener("mouseover", el._mouseenter, false);
el.removeEventListener("mouseout", el._mouseleave, false);
el._mouseenter = null;
el._mouseleave = null;
el.onmousedown = null;
}

Sorry for my bad english.
Ben
Tuesday, February 7, 2006
This line of code will disable sorting for Col 1 but leave it alone for the others.

obj.onHeaderClicked = function(event,index){if (index==1) return 'disabled'};


Hope that helps :)
Rob Francis
Tuesday, February 7, 2006

This topic is archived.


Back to support forum

Forum search