Custom action and setOptions not working together

3 posts, 0 answers
  1. Matjaž
    Matjaž avatar
    81 posts
    Member since:
    Jul 2015

    Posted 28 Jul Link to this post

    When calling setOptions, custom actions is not working anymore.

    Demo.

  2. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 01 Aug Link to this post

    Hello Matjaž,

    The described behavior is expected. Through the options there is only the meta data of the custom action existence. However, after setOptions, widget is re-rendered. Therefore, any events bound and classes added are removed after the DOM operation. This is a normal behavior when DOM elements are recreated.

    The solution is to process the custom action in the same way as initially done: 

    window.setTimeout(function(){
      myWindow.data("kendoWindow").setOptions({title: 'Not working'});
       
      myWindow.data("kendoWindow").wrapper
          .find(".k-i-mycustom").addClass("k-i-close").click(function (e) {
              alert("Custom action button clicked");
              e.preventDefault();
          });
     
      $('.armchair').html('Not working after setOptions. Icon is also changed.');
    }, 2000);

    Regards,
    Ianko
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  3. Kendo UI is VS 2017 Ready
  4. Matjaž
    Matjaž avatar
    81 posts
    Member since:
    Jul 2015

    Posted 01 Aug in reply to Ianko Link to this post

    I was hopping for some better solution.
Back to Top