Remove save cancel button in child grid

Hi, can i know how to remove save cancel button from dialog template in child grid by using actionbegin? Thank you very much

1 Reply

MS Manivel Sellamuthu Syncfusion Team May 13, 2020 09:40 AM UTC

Hi Hein, 

Greetings from Syncfusion support. 

Since while in the actionBegin event of the Child grid, the Dialog will not be rendered. So you can use actionComplete event of the Child grid to remove the save, cancel buttons of the Dialog. Please find the below code example and sample for more information. 

<script> 
        function ChildGridactionComplete(args) { 
            if (args.requestType === 'beginEdit' || args.requestType === 'add') { 
                // here we can remove the buttons for add and edit dialog of the dialog template 
                args.dialog.buttons = ""; 
                args.dialog.dataBind(); 
                let spinner = ej.popups.createSpinner({ target: args.dialog.element }); 
                ej.popups.showSpinner(args.dialog.element); 
                if (args.requestType === 'beginEdit') { 
                    var ajax = new ej.base.Ajax({ 
                        url: "@Url.Action("Editpartial", "Grid")"//render the partial view 
                        type"POST", 
                        contentType: "application/json", 
                        data: JSON.stringify({ value: args.rowData }) 
                    }); 
                    ajax.send().then(function (data) { 
                        appendElement(data, args.form); //Render the edit form with selected record 
                        args.form.elements.namedItem('CustomerID').focus(); 
                        ej.popups.hideSpinner(args.dialog.element); 
                    }).catch(function (xhr) { 
                        console.log(xhr); 
                        ej.popups.hideSpinner(args.dialog.element); 
                    }); 
                } 
                if (args.requestType === 'add') { 
                    var ajax = new ej.base.Ajax({ 
                        url: "@Url.Action("Addpartial","Grid")"//render the partial view 
                        type"POST", 
                        contentType: "application/json", 
                        data: JSON.stringify({ value: args.rowData }) 
                    }); 
                    ajax.send().then(function (data) { 
                        appendElement(data, args.form); //Render the edit form with selected record 
                        args.form.elements.namedItem('OrderID').focus(); 
                        ej.popups.hideSpinner(args.dialog.element); 
                    }).catch(function (xhr) { 
                        console.log(xhr); 
                        ej.popups.hideSpinner(args.dialog.element); 
                    }); 
                } 
            } 
        } 

Please let us know, if you know further assistance. 

Regards, 
Manivel 


Loader.
Up arrow icon