Tim
Tim

Reputation: 8921

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

Upvotes: 4

Views: 9590

Answers (2)

OnaBai
OnaBai

Reputation: 40887

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 });

Upvotes: 6

Rick S
Rick S

Reputation: 6586

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

Upvotes: 2

Related Questions