Edit this page

Dialog PHP Class Overview

The Kendo UI Dialog for PHP is a server-side wrapper for the Kendo UI Dialog widget.

Getting Started

Configuration

Below are listed the steps for you to follow when configuring the Kendo UI Dialog for PHP.

Step 1 Make sure you followed all the steps from the introductory article on Telerik UI for PHP—include the autoloader, JavaScript, and CSS files.

Step 2 Create a Dialog.

Example
    <?php
    $dialog = new \Kendo\UI\Dialog('dialog');
    $dialog->title("Software Update")
        ->width(600)
        ->closable(false)
        ->modal(false);
    ?>

Step 3 Place the content and action buttons.

Example
    <?php
    $dialog = new \Kendo\UI\Dialog('dialog');

    $noAction = new \Kendo\UI\DialogAction();
    $noAction->text("NO");

    $yesAction = new \Kendo\UI\DialogAction();
    $yesAction->text("YES")
              ->primary(true);

    $dialog->title("Software Update")                 
        ->width(600)
        ->closable(false)
        ->modal(false)
        ->addAction($noAction, $yesAction)
        ->content('Do you agree terms and conditions?');
    ?>

Step 4 Output the Dialog by echoing the result of the render method.

Example
    <?php
    echo $dialog->render();
    ?>

Event Handling

You can subscribe to all Dialog events.

Specify Function Names

The example below demonstrates how to subscribe for events by specifying a JavaScript function name.

Example
    <?php
    $dialog = new \Kendo\UI\Dialog('dialog');

    // The 'dialog_open' JavaScript function will handle the 'open' event of the dialog
    $dialog->open('dialog_open');

    echo $dialog->render();
    ?>
    <script>
    function dialog_open() {
        // Handle the open event
    }
    </script>

Provide Inline Code

The example below demonstrates how to subscribe to events by providing inline JavaScript code.

Example
    <?php
    $dialog = new \Kendo\UI\Dialog('dialog');

    // Provide inline JavaScript code that will handle the 'open' event of the dialog
    $dialog->open('function() { /* Handle the open event */ }');

    echo $dialog->render();
    ?>

Reference

Client-Side Instances

To refer to an existing Dialog instance, use jQuery.data(). Once a reference is established, use the Dialog API to control its behavior.

Example
    <?php
    $dialog = new \Kendo\UI\Dialog('dialog');
    echo $dialog->render();
    ?>
    <script>
    $(function() {
        // The constructor parameter is used as the 'id' HTML attribute of the Dialog
        var dialog = $("#dialog").data("kendoDialog");
    });
    </script>

See Also

Other articles on Telerik UI for PHP and on the dialog:

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy