ASPxClientSplitter.GetLayoutData Method
Returns a string value that represents the client state of splitter panes.
Declaration
GetLayoutData(): string
Returns
Type | Description |
---|---|
string | A string that represents the splitter pane state. |
Example
This example demonstrates how to preserve the MVC Splitter layout when an end-user expands, collapses or resizes its panes.
The Splitter extension is placed inside the CallbackPanel extension. In order to save its layout after a modification, you are required to handle corresponding client-side events and pass layout data to the server. This data is retrieved using the GetLayoutData
method and passed as a parameter via the MVCxClientCallbackPanel.PerformCallback method to the server side to the corresponding Controller Action method. Then the client layout data is applied to Splitter in the ClientLayout event handler.
server event.
@{
ViewBag.Title = "MVC Splitter - How to save the client layout of the control after every modification by an end-user";
}
<h2>MVC Splitter - How to save the client layout of the control after every modification by an end-user</h2>
<script>
var timerID = -1;
function UpdateState(s, e) {
if (timerID == -1) {
timerID = setTimeout(
function () {
CallbackPanel.PerformCallback({ layout: Splitter.GetLayoutData() });
timerID = -1;
}, 0);
}
}
</script>
<a href="@Url.Action("Index","Home")" target="_blank">Open page in new window</a>
@Html.Action("CallbackPanelPartial")