This is a migrated thread and some comments may be shown as answers.

ColumnResizing

3 Answers 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 15 Jun 2010, 09:27 PM
I see how I can cancel a resize event client side if the new value is less than required from this post:

<script type="text/javascript"
  
function ColumnResizing(sender, args) 
    var newWidth = args.get_gridColumn()._columnResizer._currentWidth; 
    if (newWidth < 200
    { 
        args.set_cancel(true); 
    } 
  
</script> 

Is it possible to set the column size to the default width here?

Something like args.get_gridColumn().set_width(200);

I didn't see anything on the column object to accomplish this.

Thanks for any help,
Robert


3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 16 Jun 2010, 07:58 AM
Hi Robert Schooley,

Column widths can be set client-side with the resizeColumn method of a client-side RadGrid tableview object:

http://www.telerik.com/help/aspnet-ajax/grid_resizecolumn.html

e.g.  gridObject.get_masterTableView().resizeColumn(... , ...);

All the best,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Robert
Top achievements
Rank 1
answered on 16 Jun 2010, 01:36 PM
Hi Dimo.

I saw that function, but it looks like it takes a column index (int).  Can I pull the column index from the column returned by get_gridColumn()?

Thanks for the response.
0
Dimo
Telerik team
answered on 18 Jun 2010, 07:42 AM
Hi Robert,

One option to retrieve the index is to use

args.get_gridColumn().get_element().cellIndex

Another option is to iterate through the columns and see which one is the same as the currently resized column:

var cols = args.get_gridColumn().get_owner().get_columns();
for (var j = 0; j < cols.length; j++)
{
      if (cols[j] == args.get_gridColumn())
      {
          //  j  is the column index
      }
}


Best wishes,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Robert
Top achievements
Rank 1
Share this question
or