How do I make the window component of Kendo UI close by clicking k-overlay?

1

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

See my window directive call:

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

The options I'm passing in the controller are below:

  vm.options = {
    modal: true,
  };

Thanks in advance for your help.

    
asked by anonymous 15.09.2015 / 15:35

1 answer

1

The only way I found to solve this problem was to add the k-on-activate attribute to the 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 looks like this:

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 , this class is created when the window component is activated.

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

    
15.09.2015 / 15:35