This is a migrated thread and some comments may be shown as answers.

Custom action and setOptions not working together

2 Answers 165 Views
Window
This is a migrated thread and some comments may be shown as answers.
Seyfor
Top achievements
Rank 1
Seyfor asked on 28 Jul 2016, 11:41 AM

When calling setOptions, custom actions is not working anymore.

Demo.

2 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 01 Aug 2016, 08:47 AM

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.
 
0
Seyfor
Top achievements
Rank 1
answered on 01 Aug 2016, 04:57 PM
I was hopping for some better solution.
Tags
Window
Asked by
Seyfor
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Seyfor
Top achievements
Rank 1
Share this question
or