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

OnColumnResized save the this.RadPersistenceManager1.SaveState

3 Answers 27 Views
Grid
This is a migrated thread and some comments may be shown as answers.
n/a
Top achievements
Rank 1
n/a asked on 05 Jul 2019, 05:16 AM

My step:

1. when i resized the column to 120px (example:before width is 100px)

2. It fired the button event after the resized the column through the javascript

3. I got: the value was 100px through  "this.RadGrid1.MasterTableView.Columns[0].HeaderStyle.Width" , (but i want the width is 120px for save the persistence to the database)

 

My question:

How can i get the resized width value,after fire column resized?

3 Answers, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 08 Jul 2019, 10:46 AM
Hi,

Here is an example JavaScript code to understand which is the new/resized width of the column:

<script type="text/javascript">
    function OnColumnResizing(sender, args) {
        // reference to the column being resized
        var currentCol = args.get_gridColumn();
 
        // get the new size adjusted by the user while dragging the column resize pointer
        var width = parseInt(currentCol._columnResizer._rightResizer.style.left, 10) - parseInt(currentCol._columnResizer._leftResizer.style.left, 10);
    }
</script>


Kind regards,
Attila Antal
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
n/a
Top achievements
Rank 1
answered on 09 Jul 2019, 08:41 AM

Thank you Attila Antal:

      Perhaps i didn't explain my question.

      I want to save the Persistence of grid to my database auto,not through clicking the button.(I only example width,other i want to save also) 

      I want to run the "this.RadPersistenceManager1.SaveState()", after the resized or reorder,but failed.

      Beacuase after resized ,the status of width was old.

      Can you give any suggest? 

      Thank you very much.

     

0
Attila Antal
Telerik team
answered on 11 Jul 2019, 04:43 PM
Hello,

Okay, so you would like to persist the settings using RadPersistance Framework. We have an online demo for that: Grid - Persisting Grid Settings. The columns cannot be resized in the demo but I have made a short video where I have isolated the demo sample and enabled Column resizing. Saving the Grid settings will include the Columns width as well: RadGrid Persistance Framework - Persist Columns Width

I hope this will help.

Kind regards,
Attila Antal
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
n/a
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
n/a
Top achievements
Rank 1
Share this question
or