Hide columns in Edit Dialog

I already checked this but this is currently not possible using just a column property, only by just using template.

It would be convenient if there is a column property like HideAtEditDialog="true" to hide columns in edit dialog aside from just disabling it.

There are some instances where you just want to hide some columns in edit dialog.


1 Reply 1 reply marked as answer

VN Vignesh Natarajan Syncfusion Team April 11, 2022 10:22 AM UTC

Hi Noel,


Greetings from Syncfusion support.


Query: “There are some instances where you just want to hide some columns in edit dialog.”


We have achieved your requirement by rendering an empty EditTemplate component to a particular column to hide that column from Dialog editing. Refer to the below code example for your reference


<SfGrid DataSource="@Orders" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })" Height="315">

    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Dialog"></GridEditSettings>

    <GridColumns>

        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" IsPrimaryKey="true" ValidationRules="@(new ValidationRules{ Required=true})" TextAlign="TextAlign.Right" Width="120"></GridColumn>

        <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" ValidationRules="@(new ValidationRules{ Required=true})" Width="120"></GridColumn>

        <GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" EditType="EditType.DatePickerEdit" Format="d" TextAlign="TextAlign.Right" Width="130" Type="ColumnType.Date">

            <EditTemplate>

 

            </EditTemplate>

        </GridColumn>

        <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" EditType="EditType.NumericEdit" Width="120"></GridColumn>

        <GridColumn Field=@nameof(Order.ShipCountry) HeaderText="Ship Country" EditType="EditType.DropDownEdit" Width="150"></GridColumn>

    </GridColumns>

</SfGrid>


EditTemplate is used to render the custom editor component in the Grid edit form, if we define empty EditForm, then it will hide the default editor component from the Edit form.


Refer to the below screenshot for your reference



Please get back to us if you have further queries.


Regards,

Vignesh Natarajan



Marked as answer
Loader.
Up arrow icon