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

Column re-size and restoring original widths

3 Answers 335 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 14 Mar 2016, 05:15 PM

If the grid column re-size is enabled and the user re-sizes one or more column in the grid. Is there any way to restore those column sizes automatically later? I've found several posts on the subject but none seem to work.

The last attempt was made using the "element" object to restore the grid column sizes:

$("#grid-id .k-grid-header-wrap").find("colgroup col").eq(xx).width(yy);
$("#grid-id .k-grid-content").find("colgroup col").eq(xx).width(yy);

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 15 Mar 2016, 01:34 PM
Hello,

You can see the thread below for more information o n how to keep and restore the resizable column width later on:
http://stackoverflow.com/questions/20379967/kendo-grid-resizable-column-width

Regards,
Maria Ilieva
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
0
Greg
Top achievements
Rank 1
answered on 15 Mar 2016, 02:45 PM

I looked at the article in above and it doesn't appear to have any solutions. I'm not looking to tie into the "columnResize" event. By then it's too late. What I'm looking for is a means to reset all the column width in the grid UI back to their original size.

The post below does not work:

Your code doesn't trigger columnResize event, but binds columnResize event handler instead. Anyway, triggering the event doesn't help, probably because the event itself is generating by the resize handle after it really resized the column. The code below triggers the event, but it doesn't help: g = $('#grid') gg = g.getKendoGrid() gg.trigger('columnResize',{column:gg.columns[1],oldWidth:gg.columns[1].width,new‌Width:400,sender:gg}) (don't know, why the code is not formatting as described in the help) – nnseva

0
Maria Ilieva
Telerik team
answered on 18 Mar 2016, 11:48 AM
Hello Greg,

Now I understand your requirement and would suggest you to revise the example below that demonstrates a possible approach for achieving the required functionality:
http://jsfiddle.net/OnaBai/a9QSr/


Regards,
Maria Ilieva
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
Greg
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Greg
Top achievements
Rank 1
Share this question
or