We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Access the Dialog when using Dialog Edit

I need to access the Dialog that is created for add/edit when using this code:

    <div id="SliderPageItems" data-bind="ejGrid: {
    dataSource: dataSource,
    columns: column,
    toolbarSettings:
        {
            showToolbar: true,
            toolbarItems: tool
        },
    actionComplete: 'complete',
    endEdit: 'endEdit',
    endAdd: 'endAdd',
    editSettings:
        {
            allowEditing: true,
            allowAdding: true,
            allowDeleting: true,
            editMode: 'dialogtemplate',
            dialogEditorTemplateID: '#template'
     },
     allowGrouping: false,
     allowSorting: false,
     allowPaging: false,
     allowFiltering: false,
     }" />

Thanks!

B

1 Reply

MS Madhu Sudhanan P Syncfusion Team January 21, 2015 09:23 AM UTC

Hi Bruce,

Thanks for using Syncfusion products.

Query : “I need to access the Dialog that is created for add/edit”

We can access the Editing Dialog that will created during Edit operation using the id of the dialog. The Id of the dialog will be in the following format.

$("#" + GridId + "_dialogEdit"); //Where GridId is grid element id

For you convenience we have created a simple Knockout sample with Dialog Template editing and the same can be downloaded from the below location.

Sample Location: http://www.syncfusion.com/downloads/support/directtrac/118004/Ko-DialogTemplate1860974782.zip

In the above link sample, we have access the grid edit dialog in the actionComplete event as follows.

function complete(args) {

            if (args.requestType == "beginedit" || args.requestType == "add") {

                //Get grid element id

                var gridId = this.element.attr("id");

                //Get the edit dialog

                var dlgElement = $("#" + gridId + "_dialogEdit");

                //Get Dialog instance

                var dlgInstance = dlgElement.ejDialog("instance");

                //Check whether the dialog is opened

                if (dlgInstance.isOpened()) {

                    var dropdown = dlgElement.find("#FirstName").ejDropDownList({

                        dataSource: window.employeeView,

                        fields: { text: "FirstName" }                       

                    }).ejDropDownList("instance");

                    dropdown.setSelectedText($("#FirstName").val());

                }

            }

        }

In the above code snippet, we have obtained the dialog instance and using that we have rendered a ejDropDownList to edit “FirstName”  field.

Please let us know if we misunderstood your requirement and provide us more information regarding your requirement. The information provided would be more helpful for us to analyze the issue and provide you the response as early as possible.

Regards,

Madhu Sudhanan. P



Loader.
Live Chat Icon For mobile
Up arrow icon