Creating a dynamic EjsGrid, Grid freezes while trying to edit
I created an algorithm that adds/removes items from an EjsGrid based on items from an EjsTreeView checklist. That part works fine and I accomplished it by using @ref on the EjsGrid, however I want one of the columns to be editable. When I try to edit the column in question, the grid freezes. Perhaps I am referencing something wrong and not passing the user's inputted data correctly. I have attached my Visual Studio project. Checkout.razor is the page I am working on.
Attachment: FrontCounter_e266e54a.zip
My grid looks like (as you will see in the zip file):
<EjsGrid DataSource="FinalItems" @ref="grid">
<GridEditSettings AllowEditing="true"></GridEditSettings>
<GridColumns>
<GridColumn AllowEditing="false" Field=@nameof(CheckoutItem.Name) HeaderText="Name" Width="50"></GridColumn>
<GridColumn Field=@nameof(CheckoutItem.Quantity) HeaderText="Quantity" Width="35" EditType="EditType.NumericEdit"></GridColumn>
</GridColumns>
</EjsGrid>
Whenever I attempt to edit Quantity, it freezes.
Attachment: FrontCounter_e266e54a.zip
SIGN IN To post a reply.
3 Replies
RS
Renjith Singh Rajendran
Syncfusion Team
November 20, 2019 11:43 AM UTC
Hi Brian,
Thanks for contacting Syncfusion support.
The problem occurred because of not enabling the “IsPrimaryKey” property for a unique value column in Grid. To perform editing in Grid, it is a must to define a unique value column as primary key column.
We suggest you to ensure to provide “IsPrimaryKey” property for any one of the unique value column in Grid.
Documentation : https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_IsPrimaryKey
|
<GridColumns>
<GridColumn AllowEditing="false" IsPrimaryKey="true" Field=@nameof(CheckoutItem.Name) HeaderText="Name" Width="50"></GridColumn>
<GridColumn Field=@nameof(CheckoutItem.Quantity) HeaderText="Quantity" Width="35" EditType="EditType.NumericEdit"></GridColumn>
</GridColumns>
|
Please get back to us if you need further assistance.
Regards,
Renjith Singh Rajendran.
Hi Brian,
Thanks for contacting Syncfusion support.
The problem occurred because of not enabling the “IsPrimaryKey” property for a unique value column in Grid. To perform editing in Grid, it is a must to define a unique value column as primary key column.
We suggest you to ensure to provide “IsPrimaryKey” property for any one of the unique value column in Grid.Documentation : https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_IsPrimaryKey
<GridColumns><GridColumn AllowEditing="false" IsPrimaryKey="true" Field=@nameof(CheckoutItem.Name) HeaderText="Name" Width="50"></GridColumn><GridColumn Field=@nameof(CheckoutItem.Quantity) HeaderText="Quantity" Width="35" EditType="EditType.NumericEdit"></GridColumn></GridColumns>
Please get back to us if you need further assistance.
Regards,Renjith Singh Rajendran.
Thank you this solved my issue.
I am now trying to set it where the minimum value of the Quantity column is 1 and I am also trying to remove decimal input. How can I do this?
RS
Renjith Singh Rajendran
Syncfusion Team
November 21, 2019 11:52 AM UTC
Hi Brian,
We suggest you to use the “Edit params feature” of Grid. In this, set the “Min” and “Format” properties of EjsNumericTextBox to achieve your requirement. Please refer the documentation link below,
Documentation : https://ej2.syncfusion.com/blazor/documentation/grid/editing/#cell-edit-type-and-its-params
Please use the code below,
|
<div class="column2">
<EjsGrid DataSource="FinalItems" @ref="grid">
<GridEditSettings AllowEditing="true"></GridEditSettings>
<GridColumns>
<GridColumn AllowEditing="false" IsPrimaryKey="true" Field=@nameof(CheckoutItem.Name) HeaderText="Name" Width="150"></GridColumn>
<GridColumn Field=@nameof(CheckoutItem.Quantity) ... EditType="EditType.NumericEdit" Edit="@QuantityEditParams"></GridColumn>
</GridColumns>
</EjsGrid>
</div>
@code{
public object QuantityEditParams = new
{
@@params = new EjsNumericTextBox<int>() { Min = 1, Format = "N0" }
};
...
}
|
Please get back to us if you need further assistance.
Regards,
Renjith Singh Rajendran.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
BR Brian
- Nov 19, 2019 09:01 PM UTC
- Nov 21, 2019 11:52 AM UTC