how to hide the close button on a kendo modal window

9.1k views Asked by At

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();
2

There are 2 answers

1
OnaBai On BEST ANSWER

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 });
1
Rick S On

I believe you can do it like this:

// hide the close [x] button
 $scope.modalWindow.parent().find(".k-window-action").css("visibility", "hidden");

Here is a sample jsFiddle