OnColumnResized save the this.RadPersistenceManager1.SaveState

4 posts, 0 answers
  1. 94550306
    94550306 avatar
    12 posts
    Member since:
    Jan 2015

    Posted 05 Jul 2019 Link to this post

    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?

  2. Attila Antal
    Admin
    Attila Antal avatar
    520 posts

    Posted 08 Jul 2019 Link to this post

    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.
  3. 94550306
    94550306 avatar
    12 posts
    Member since:
    Jan 2015

    Posted 09 Jul 2019 in reply to Attila Antal Link to this post

    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.

         

  4. Attila Antal
    Admin
    Attila Antal avatar
    520 posts

    Posted 11 Jul 2019 Link to this post

    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.
Back to Top