:: Forum >> Version 2 >>

double-click the separator

Hey,

I've written some code to do an auto-resize of the column based on the data content, but I don't know how to assign the double-click event to the separator. Right now I have it assigned to a double-click of the cell. Is there an onSeparatorDoubleClicked method? Also, does anybody know a better way to calculate how wide my column should be? Here's my code -
obj.onCellDoubleClicked = function(eventcolrow){
                   var 
curChars 0;
                    
/* Start with the # of characters in the header */
                   
maxChars myColumns[col].length;
                   for(var 
0obj.getRowCount(); i++)
                   {
     
                    
/* Get the max # of characters in the column */
                       
curChars myData[i][col].length;
                       if(
curChars maxCharsmaxChars curChars;
                   }
                   if(
maxChars 0)
                   {
                        
/* My best guess as to how wide to resize the column based on Tahoma, 8pt font*/
                       
var width maxChars Math.ceil(maxChars 20);
                       
obj.setColumnWidth(widthcol);
                   }
              };
 
Chris
Tuesday, May 23, 2006
*bump...
Chris
Thursday, May 25, 2006
The separator template does not raise mouse events but you can add one yourself -

obj.getSeparatorTemplate().setEvent("ondblclick", function(event){
    
this.raiseEvent("onSeparatorDoubleClicked"eventthis.$0);
});


obj.onSeparatorDoubleClicked = function(eventcolumn){
    
alert(column);
};

 
Alex (ActiveWidgets)
Thursday, May 25, 2006



This topic is archived.

Back to support forum

Forum search