3.2.0

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(event, col, row){
                   var curChars = 0;
                    /* Start with the # of characters in the header */
                   maxChars = myColumns[col].length;
                   for(var i = 0; i < obj.getRowCount(); i++)
                   {
     
                    /* Get the max # of characters in the column */
                       curChars = myData[i][col].length;
                       if(curChars > maxChars) maxChars = curChars;
                   }
                   if(maxChars > 0)
                   {
                        /* My best guess as to how wide to resize the column based on Tahoma, 8pt font*/
                       var width = maxChars * 6 + Math.ceil(maxChars / 20);
                       obj.setColumnWidth(width, col);
                   }
              };
Chris
May 23,
*bump...
Chris
May 25,
The separator template does not raise mouse events but you can add one yourself -

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


obj.onSeparatorDoubleClicked = function(event, column){
    alert(column);
};
Alex (ActiveWidgets)
May 25,

This topic is archived.

See also:


Back to support forum