Data Grid - Column Resizing

This example uses the command setColumnWidth(colNum, width) to dynamically change the width sizes of columns.

    Syntax: myGrid.setColumnWidth(colNum, widthInPixel);

In the example, this command is called in the function setcolwidth(aObj1, aObj2) when the button "Set Column" is clicked. The function setcolwidth is called with the dropdown and field object reference passed as first and second parameter. The current value of each object will then be used to call the command setColumnWidth for myGrid.

    function setcolwidth(aObj1, aObj2){
        var colnum = aObj1.options[aObj1.selectedIndex].value; // Retrieve column number
        var newcolsize = aObj2.value; // Retrieve column size
        if(isInteger(newcolsize)){
            if(newcolsize<10 && newcolsize<1000)
                alert("Value needs to be more than 10 and less than 1000")
            else
                myGrid.setColumnWidth(colnum, newcolsize); //Set the column width
        }
    }