1

Can we force the Kendo to change the "collapsible: false" property of splitter to "collapsible: true" on click of a button??

On load, if the Splitter property "collapsible" is set to "false", then the user cannot collapse it back..

So is there anyway if I set the property "collapsible:false" but on click of the button at run time change the property to "collapsible:true" and then collapse and then set it back to "collapsible:false"???

Here is my code:

HTML

<p>
    <button id="collapsePane" type="button" class="k-button">Collapse left pane</button>
    <button id="expandPane" type="button" class="k-button">Expand left pane</button>
</p>
<div id="splitter">
    <div id="left">Left column</div>
    <div>Main content</div>
</div>

JS

var splitterElement = $("#splitter").kendoSplitter({
    panes: [{
        size: "15%",
        resizable: true,
        collapsible: false,
    }, {
        size: "85%",
        resizable: true,
    }]
});


var splitter = splitterElement.data("kendoSplitter");

$("#collapsePane").click(function (e) {
    var splitter = $("#splitter").data("kendoSplitter");
    $("#left").collapsible(true);  /*How to change this property?*/
    splitter.collapse("#left");
});

$("#expandPane").click(function (e) {
    var splitter = $("#splitter").data("kendoSplitter");
    splitter.expand("#left");
});

Here is the Link for the demo of my code: http://jsfiddle.net/hxtxokoq

Please suggest and let me know if you need any other details.

Thanks in advance!

UID
  • 4,434
  • 11
  • 45
  • 75
  • Is this what you're trying to do? http://jsfiddle.net/4w7k3gz3/1/ – APAD1 Aug 17 '15 at 21:16
  • No, Actually what I'm trying to is, On load of the splitter, set the collapsible property to "false", then later if u want to expand or collapse, you won't be able to do that... so what I thought.. which could be one of the way is set the collapsible property back to "True" at run time, by the click of a "Button" – UID Aug 17 '15 at 21:22
  • Please refer this Fiddle: http://jsfiddle.net/hxtxokoq/ – UID Aug 17 '15 at 21:23

1 Answers1

3

Try changing your $("#left").collapsible(true); to:

splitter.options.panes[0].collapsible = true;

Updated jsfiddle: http://jsfiddle.net/4w7k3gz3/3/

Edit: And here's the documentation used to find a solution: http://docs.telerik.com/kendo-ui/web/splitter/overview#change-pane-settings-after-initialization

Matt Hansen
  • 424
  • 1
  • 6
  • 16