Search code examples
javascriptjqueryresizetelerik-gridradgrid

AllowColumnResize at client side using javascript function


How to set AllowColumnResize=true at client side using javascript in master pages using the CSS selector , so that it would apply to all the grid specified with .

My effort-

 function pageLoad()
    {
        var grid = $find(".ScrollGrid");
        var columns = grid.get_masterTableView().get_columns();

        for (var i = 0; i < columns.length; i++) //
        {
            columns[i].resizeToFit();
        }
    }

But not successful .Please help.


Solution

  • After a long debugger mode searching , finally my friend found the property -

    grid.get_masterTableView()._owner.ClientSettings.Resizing.AllowColumnResize=true;
    

    so no need to loop around, a single line can do the trick

    function pageLoad()
    {
        var grid = $find(".ScrollGrid");
        grid.get_masterTableView()._owner.ClientSettings.Resizing.AllowColumnResize=true;
    }