How to sort on first header but not the second header

Take a look at this image. The columns properly sort when clicking on them, but I do not want sorting to occur when they click the info icon. How would I accomplish this?

[code]dhxGrid.setHeader(“,ID,Code,Name,R,SC,P,PM”);
dhxGrid.setColSorting(“na,int,str,str,int,int,int,int”);

dhxGrid.attachHeader(“,#text_filter,#text_filter,#text_filter,<a href="javascript:n1();"><img src="images/dhtmlx/page_info.gif" />,<a href="javascript:n2();"><img src="images/dhtmlx/page_info.gif" />,<a href="javascript:n3();"><img src="images/dhtmlx/page_info.gif" />,<a href="javascript:n4();"><img src="images/dhtmlx/page_info.gif" />”);

dhxGrid.setColAlign(“center,left,left,left,right,right,right,right”);
dhxGrid.setInitWidths(“60,60,100,*,40,40,40,40”);
dhxGrid.setColTypes(“ch,ro,ro,ro,ro,ro,ro,ro”);
dhxGrid.setColumnHidden(1,true);
dhxGrid.init();[/code]

I’ve tried using the “onBeforeSorting” event but there is nothing to differentiate the top bar from the bottom bar.

Thank you!

Please, try to use the following solution:

dhxGrid.load(url,function(){ dhxGrid.hdr.row[1].onclick=function(e){(e||event).cancelBubble=true}; })

Thanks, didn’t work though. See image…


In the header define the image with an onclick function as:

<img onclick="click();" src="....">

Then preventDefault and stop Proagation as:

function click(ev){
  ev.preventDefault();
  ev.stopPropagation();
}

This is a nicer–more complete solution:

dhxGrid.attachEvent("onHeaderClick", function(ind,obj){
  if (arguments[1].srcElement.innerHTML.indexOf('page_info.gif') == -1) 
    return true  
  else 
    return false
});

This prevents sorting even when the user clicks the right/left of the icon.

Thanks, didn’t work though. See image…

I apologize. It’s my mistake. Pleas,e try to use the following code:

dhxGrid.load(url,function(){ dhxGrid.hdr.rows[2].onclick=function(e){(e||event).cancelBubble=true}; });