GridCommandColumn edit dialog

Hi

I'm using GridCommandColumn for three different operations.


                    <GridColumn HeaderText="Ok" Width="40">

                        <GridCommandColumns>

                            <GridCommandColumn Type="CommandButtonType.None" ID="Answer" ButtonOption="@(new CommandButtonOptions() {IconCss="e-icons e-check", CssClass="e-flat" })"></GridCommandColumn>

                        </GridCommandColumns>

                    </GridColumn>

                    <GridColumn HeaderText="Edit" Width="40">

                        <GridCommandColumns>

                            <GridCommandColumn Type="CommandButtonType.Edit" ID="Edit" ButtonOption="@(new CommandButtonOptions() {IconCss="e-icons e-edit", CssClass="e-flat" })"></GridCommandColumn>

                        </GridCommandColumns>

                    </GridColumn>

                    <GridColumn HeaderText="Pdf" Width="40">

                        <GridCommandColumns>

                            <GridCommandColumn Type="CommandButtonType.None" ID="Document" ButtonOption="@(new CommandButtonOptions() {IconCss="oi oi-list-rich", CssClass="e-flat" })"></GridCommandColumn>

                        </GridCommandColumns>



    public async void CommandClickHandler(CommandClickEventArgs<Inspection> args)

    {

        if (args.CommandColumn.ID == "Answer")

        {

            args.RowData.Answer = "Uygun";

            await InspectionServ.UpdateInspectionAsync(args.RowData);

            InspectionGrid.Refresh();

        }

        else if (args.CommandColumn.ID == "Edit")

        {

            await InspectionGrid.StartEdit();

        }

        else if (args.CommandColumn.ID == "Document")

        {

            DocumentPath = "wwwroot/Files/References/" + args.RowData.InspectionId + ".pdf";

            Header = "Referans Dosyası - " + args.RowData.InspectionId;

            await pdfDialog.Show();

        }

    }



How can I make the edit column open the default dialog ? When I use  "await InspectionGrid.StartEdit()" default dialog is opening but when i close it, it says " no records selected for edit operation".So i should close custom edit and open it default just like the toolbar does.

By the way, the reason why I put an edit button on gridcolumn too is for tablets and phones.So it shoud work with double click or edit button.

I have attached the sample video and code.








Attachment: Syncfsn_b6b6f6ab.zip

1 Reply 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team February 1, 2022 12:12 PM UTC

Hi M.Alp, 
 
Greetings from Syncfusion support. 
 
We have analyzed your shared codes and we could see that you have set CommandButtonType as Edit for the Command button. At these cases, there is no need for calling StartEdit to programmatically open the default edit dialog. Setting the CommandButtonType as Edit will by default set the button to act as editing action performing button. We have prepared a sample, without calling the StartEdit to open default edit dialog when pressing edit button. Please download and refer the sample from the link below, 
 
Also from your shared codes we could see that you have not enabled primary key for any of the GridColumn. We suggest you to ensure to set IsPrimaryKey property for a unique valued column in grid. It is a must to set a unique valued column as primary key to perform CRUD operations in Grid. Please refer the below documentation for more details, 
 
Query : dialog is opening but when i close it, it says " no records selected for edit operation" 
Also we checked this scenario with the above sample, but we could not face this scenario when closing the default edit dialog. Kindly refer the above sample and check this from your side, and if you are facing difficulties then kindly share with us a simple issue reproducing sample for us to validate based on this scenario. 
 
Regards, 
Renjith R 


Marked as answer
Loader.
Up arrow icon