Search code examples
kendo-uikendo-window

how to hide the close button on a kendo modal window


I have a kendo modal window in my angular app. Sometimes I auto-close the window after a second. At those times, I'd like to hide the Close [x] button, but at other times, not. Can it be done just before the window is opened?

    if (autoCloseDelay)        {
        // hide the close [x]  button here ??
        $timeout( function() {
            $scope.modalWindow.close();
        }, autoCloseDelay, $scope);
    }
    $scope.modalWindow.open();

Solution

  • If you don't want to play with CSS, you can use setOptions to set programmatically the actions.

    Example for removing the Close button:

    // Get current actions
    var actions = $scope.modalWindow.options.actions;
    // Remove "Close" button
    actions.splice(actions.indexOf("Close"), 1);
    // Set the new options
    $scope.modalWindow.setOptions({ actions : actions });