Adding new reco

Hello,


I would like to add a new record using Edit.Mode.Dialog.  

The problem is that OnGet method I would like to see only few data like description, amount and color. But to create a new item I need to add  more information like companyId, typeid etc.

Is it possible to have a diolog mode with more input data then I let to be visible to the client?


 code sample is :

<SfGrid @ref="hotelLinenGrid" DataSource="@Linens" AllowPaging="true" AllowSorting="true" AllowFiltering="true" Toolbar="Toolbaritems">

        <GridEvents OnToolbarClick="ToolbarClickHandler" RowSelected="RowSelectHandler" OnActionBegin="ActionBeginHandler" TValue="HotelLinen"></GridEvents>

        <GridPageSettings PageSize="10" PageCount="5" PageSizes="@pagerDropdown"></GridPageSettings>

        <GridFilterSettings Mode="Syncfusion.Blazor.Grids.FilterBarMode.Immediate" Type="Syncfusion.Blazor.Grids.FilterType.Menu"></GridFilterSettings>

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


        <GridColumns>

            <GridColumn Visible="false" IsPrimaryKey="true" Field=@nameof(HotelLinen.Id) HeaderText="ID"></GridColumn>

            <GridColumn Visible="false" Field="@nameof(HotelLinen.HotelLinenTypeId)" HeaderText="Type name"></GridColumn>

            <GridColumn Visible="false" Field=@nameof(HotelLinen.CompanyId) HeaderText="CompanyId"></GridColumn>

            <GridColumn Field=@nameof(HotelLinen.NameWithShortDescription) HeaderText="Description"></GridColumn>

            <GridColumn Field=@nameof(HotelLinen.Color) HeaderText="Color"></GridColumn>

            <GridColumn Field=@nameof(HotelLinen.Amount) HeaderText="Amount"></GridColumn>

        </GridColumns>

    </SfGrid>


1 Reply

RS Renjith Singh Rajendran Syncfusion Team September 10, 2021 02:28 AM UTC

Hi Jaroslaw, 

Greetings from Syncfusion support. 

We have already documented this topic in our UG documentation section, you can render a customized edit dialog form using Dialog Template feature of Gird. Please refer the below documentation for more details.  

Or if you have already defined the GridColumn for the Fields(HotelLinenTypeId, CompanyId), then you can also set Width as 0 for your columns(HotelLinenTypeId, CompanyId) instead of setting Visible as false. This will also hide the columns(HotelLinenTypeId, CompanyId) from displaying in Grid and display the columns in Grid edit dialog form. 

 
<GridColumn Width="0" Field="@nameof(HotelLinen.HotelLinenTypeId)" HeaderText="Type name"></GridColumn> 
<GridColumn Width="0" Field=@nameof(HotelLinen.CompanyId) HeaderText="CompanyId"></GridColumn> 


You can use either one of the above two suggestions. Please get back to us if you need further assistance. 

Regards, 
Renjith R 


Loader.
Up arrow icon