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

API for resizing columns on client side using javascript

6 Answers 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mirang
Top achievements
Rank 1
Mirang asked on 18 Jul 2012, 01:17 PM
Does the Grid has any client side API for column resizing using javascript?

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 18 Jul 2012, 01:27 PM
Hi Mirang,

You can use the client event OnColumnResizing in javascript for catching resizing of columns.
aspx:
<telerik:RadGrid runat="server">
  <ClientSettings>
    <ClientEvents OnColumnResizing="OnColumnResizing" />
    <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="false"
      ClipCellContentOnResize="true" EnableRealTimeResize="false" AllowResizeToFit="true" />
  </ClientSettings>
  ...
</telerik:RadGrid>

JS:
function OnColumnResizing(sender,args) {
alert("fired");
}

Thanks,
Shinu.
0
Mirang
Top achievements
Rank 1
answered on 18 Jul 2012, 01:29 PM
I wanted to resize the columns from the javascript code. I just got across this link

http://www.telerik.com/community/forums/aspnet-ajax/grid/get-set-column-width-from-client-side.aspx 

Is it useful ?
0
Antonio Stoilkov
Telerik team
answered on 23 Jul 2012, 10:27 AM
Hi Mirang,

You could achieve your scenario by using the RadGrid client-side API which provides way to resize table view columns. Every GridTableView client-side object includes resizeColumn function which usage is described in the help article below.

Additionally, the example below shows how to use the resizeColumn method specifying the column index as first parameter and its width for seconds parameter.
$find("RadGrid1").get_masterTableView().resizeColumn(1, 120)

Greetings,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Teju
Top achievements
Rank 1
answered on 10 Sep 2015, 06:44 AM
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.
0
Teju
Top achievements
Rank 1
answered on 10 Sep 2015, 07:46 AM

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

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

 

0
Eyup
Telerik team
answered on 11 Sep 2015, 01:17 PM
Hello Teju,

You can even shorten it as follows:
grid.ClientSettings.Resizing.AllowColumnResize=true;

Hope this helps.

Regards,
Eyup
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Mirang
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Mirang
Top achievements
Rank 1
Antonio Stoilkov
Telerik team
Teju
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or