When e.preventDefault() is not preventing....

2 posts, 0 answers
  1. nachid
    nachid avatar
    190 posts
    Member since:
    Mar 2010

    Posted 02 Jul 2012 Link to this post

    I am doing this directly on the ajax demo page. so you can test it for yourself.
    I used firebug console and I binded a select hander on the panelbar.
    $("#panelbar").data('kendoPanelBar').bind('select', function (e) { e.preventDefault(); });
    You can see when you click on a panel, it is expanded and the underlying ajax call is made
    The preventDefault is not taken into account.

    I had to use recursion to make work as it is supposed to
    var event= $("#panelbar").data('kendoPanelBar').bind('select', function (e) { event.preventDefault(); });

  2. Kevin
    Kevin avatar
    2 posts
    Member since:
    Feb 2013

    Posted 21 Apr in reply to nachid Link to this post

    I was trying this out, as I also wanted to disable selection in the panelbar.  e.preventDefault() didn't work, even with the recursive technique.  The following worked for me:

    var panelbar = $("#panelbar").data('kendoPanelBar');
    panelbar.bind('select', function(e) { panelbar.clearSelection(); });

    (Note: I just wanted to disable selection, not expansion.)

Back to Top