Blocking Panelbar Expansion

4 posts, 0 answers
  1. Josh
    Josh avatar
    1 posts
    Member since:
    Mar 2012

    Posted 08 Mar 2012 Link to this post

    I'm trying to block the expansion of a panel bar to no avail. I've tried both of these methods on the select and expand event:

    function OnSelect(e) {

    function OnExpand(e) {

    I just really need a method to block the expansion if something fails, any suggestions or alternatives would be welcome.
  2. Zack
    Zack avatar
    112 posts
    Member since:
    Jun 2012

    Posted 14 May 2012 Link to this post

    Hi Josh, I am able to block expanding or collapsing in our apps by doing the following:

       expand: function (e) {
          if ( == 'SpecificListItemID') e.preventDefault();

    I have tested this with success for both expand and collapse events.
  3. Coty
    Coty avatar
    41 posts
    Member since:
    Jun 2014

    Posted 17 Feb Link to this post

    I actually had a similar question to this.  Zack is correct in that you can prevent the expand within the expand method of the panelbar by calling e.preventDefault().  

    However, is there a way to disable the expand from the onSelect event?  I did a workaround with a flag variable but I was hoping there was a better way.

        select: function (e) {
            if (expand) {
                console.log("set expand false");
                expand = false;
            } else {
                expand = true;
                console.log("set expand true");
        collapse: function (e) {
            console.log("collapse, expand=", expand);
            if (!expand) { e.preventDefault();}
        expand: function (e) {
            console.log("expand, expand=", expand);
            if (!expand) { e.preventDefault(); }
        expandMode: "multiple"

  4. Petyo
    Petyo avatar
    2437 posts

    Posted 23 Feb Link to this post

    Hello Coty,

    your approach seems correct. The select event does not support prevention, currently. 

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top