How to make the Kendo UI window component close when clicking on k-overlay?

Asked

Viewed 35 times

1

The company where I work uses the components of Kendo UI and I need to have the window component closed when clicking on k-overley (window backdrop), this component is configured to have modal behavior.

View my Directive call from the window:

<div kendo-window="ctrl.window" k-options="ctrl.options" k-content="{ url: '/window.html' }"></div>

The options I’m passing on the controller are below:

  vm.options = {
    modal: true,
  };

Thanks for your help.

1 answer

1


The only way I found to solve this problem was by adding the attribute k-on-activate in Directive with a call to a function in the controller:

<div kendo-window="ctrl.window" k-options="ctrl.options" k-on-activate="ctrl.close()" k-content="{ url: '/window.html' }"></div>

The function was thus:

vm.close = function() {
  self = this;

  angular.element('.k-overlay').bind('click', function () {
    self.window.close();
  });
}

This function adds a bind to the class .k-overlay, class is created when the window component is activated.

I hope to be helping other people who are having the same need.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.