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

Remember splitter position

5 Answers 253 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Warren
Top achievements
Rank 1
Warren asked on 10 Feb 2014, 05:57 PM
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?

5 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 11 Feb 2014, 03:25 PM
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!
0
Warren
Top achievements
Rank 1
answered on 12 Feb 2014, 09:47 PM
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
0
Alex Gyoshev
Telerik team
answered on 13 Feb 2014, 08:14 AM
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!
0
Warren
Top achievements
Rank 1
answered on 20 Feb 2014, 09:41 PM
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;
};
0
Johannes
Top achievements
Rank 1
answered on 12 Jun 2014, 11:16 AM
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.
Tags
Splitter
Asked by
Warren
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Warren
Top achievements
Rank 1
Johannes
Top achievements
Rank 1
Share this question
or