3.0 beta 2

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
September 7,
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)
September 7,
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
September 8,
sorry, I should use || intead of && ....
It's working fine!!!
Thanks!
Sergio
September 8,
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
September 14,
I have this problem also. Is there a solution for this?
Ben
January 27,
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
February 7,
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
February 7,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.