Remember splitter position

6 posts, 0 answers
  1. Warren
    Warren avatar
    3 posts
    Member since:
    Apr 2013

    Posted 10 Feb 2014 Link to this post

    Some of the open source splitter plugins have a rememberme option that remembers the position of the splitters between page refreshes.  Normally they store this information in a cookie, but sometimes you can override and use localStorage instead.  Does the kendoSplitter have a similiar rememberme function?   Would it be difficult t write one?
  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 11 Feb 2014 Link to this post

    Hello Warren,

    Such functionality is not supported at this time. If you decide to implement this, you can save the pane size in the resize event and restore them when initializing the widget.

    Regards,
    Alex Gyoshev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Warren
    Warren avatar
    3 posts
    Member since:
    Apr 2013

    Posted 12 Feb 2014 in reply to Alex Gyoshev Link to this post

    Alex,

    How can I get the panel size?  Whenever I look in the resize event, it seems to have the size before the actual resizing occurred.

    -Warren
  5. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 13 Feb 2014 Link to this post

    Hello Warren,

    In more recent versions of Kendo UI, the resize event is triggered after the panes have been resized. In versions prior to Q3 2013, use the layoutChange event.

    Regards,
    Alex Gyoshev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. Warren
    Warren avatar
    3 posts
    Member since:
    Apr 2013

    Posted 20 Feb 2014 Link to this post

    Just adding my final implementation in case anyone else is wondering:

    KendoSplitterDefaults = {
        "advSearchNorthSize": "25px",
        "advSearchSouthSize": "124px",
        "advSearchWestOuterSize": "175px",
        "advSearchEastSize": "200px",
        "advSearchWestNorthSize": "60px",
        "advSearchWestSouthSize": "250px",
        "portal-westSize": "15%"
    };
     
    SaveKendoSplitterSize = function (e) {
         /// <summary>
         /// Saves the size for all panes in a kendo splitter to localStorage
         /// </summary>
         /// <param name="e">KendoUI Splitter resize event</param>
         e.sender.element.find(".k-pane").each(function () {
              var kendoPane = $(this).data("pane");
              var kendoPaneId = $(this).attr("id");
              localStorage.setItem(kendoPaneId + "Size", kendoPane.size);
         });     
    };
     
    LoadKendoSplitterSize = function (id) {
         /// <summary>
         ///
         /// </summary>
         /// <param name="id">Id of kendo splitter pane to load from localStorage</param>
         /// <returns type="Number">Size of pane in kendo splitter</returns>
          
         // Cache id+size as key to lookup from localstorage/default index
     
         // Attempt local storage lookup
         var tempPaneSize = localStorage.getItem(id + "Size");
     
         // If that fails, look up from enum in frameworks
         if (tempPaneSize === null ||  tempPaneSize === "undefined") {
              tempPaneSize = KendoSplitterDefaults[id + "Size"];
         }
     
         return tempPaneSize;
    };
  7. Johannes
    Johannes avatar
    1 posts
    Member since:
    Jun 2014

    Posted 12 Jun 2014 Link to this post

    IMO your solution does not work well.

    If you change the splitter with the methods "insertBefore" or "insertAfter" the value size is not updated.

    You can just read the width css attribute with jquery. That's it.
Back to Top
Kendo UI is VS 2017 Ready