Why GridColumn EditTemplate with DropDownList dosen't update complex model field value?
Hi team,
Attachment: SyncfusionBlazorGird_DropDownList_EditTemplate_Issue_b3ed342b.rar
I have a grid with complex model, and I use a SfDropDownList template to edit it's "Order.Address.ShipCountry" property. but when the value being modified and the OnActionComplete event being triggered, I found that ShipCountry property in the ActionEventArgs.Data, which should be the new value after modification, didn't change. I made a sample project to show the case. Please check if my DropDownList in the EditTemplate has something wrong. Thanks.
Regards.
Attachment: SyncfusionBlazorGird_DropDownList_EditTemplate_Issue_b3ed342b.rar
SIGN IN To post a reply.
7 Replies
1 reply marked as answer
VN
Vignesh Natarajan
Syncfusion Team
June 25, 2020 05:16 AM UTC
Hi Brian,
Thanks for contacting Syncfusion support.
Query: “which should be the new value after modification, didn't change”
From your query we understand that you are facing issue while saving the value for complex column data with Edit Template. We are able to reproduce the reported issue in the provided sample at our end. ID property of Editor components must match GridColumn Field value. So for complex column, ID property has to define in below way (___ must be used in place of .) to resolve the issue.
Refer the below code example.
|
<SfGrid ID="Grid" DataSource="@Orders" @ref="Grid" AllowFiltering="true" AllowGrouping="true" AllowExcelExport="true"
Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update","ExcelExport"})" Height="315" Width="900">
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Normal"></GridEditSettings>
<GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.FilterBar"></GridFilterSettings>
<GridEvents OnActionComplete="ActionCompletedHandler" OnToolbarClick="ToolbarClick" TValue="Order"></GridEvents>
<GridColumns>
. . . . . . . .
<GridColumn Field="Address.ShipCountry" HeaderText="Ship Country" EditType="EditType.DropDownEdit" Width="150">
<EditTemplate>
<SfDropDownList ID="Address___ShipCountry" TValue="string" TItem="string" DataSource="@_countries" Value="@((context as Order).Address.ShipCountry)">
<DropDownListFieldSettings Value="Address.ShipCountry"></DropDownListFieldSettings>
</SfDropDownList>
</EditTemplate>
</GridColumn>
</GridColumns>
</SfGrid>
|
Please find the modified sample from below
Sample: https://www.syncfusion.com/downloads/support/forum/155476/ze/SyncfusionBlazorGird-1287892297
Kindly get back to us if you have further queries.
Regards,
Vignesh Natarajan
Marked as answer
BR
Brian
June 26, 2020 12:00 AM UTC
Thanks, it works. Anyway, the "___" is really a hard magic word to guess out. Do you have some secret reference guide for similar issues? :)
VN
Vignesh Natarajan
Syncfusion Team
June 26, 2020 09:11 AM UTC
Hi Brian,
Thanks for the update.
We are glad to hear that you have resolved your query using our solution.
Refer our UG documentation for your reference
Already we have logged an improvement task to update the UG documentation and it will be refreshed online as soon as possible.
Kindly get back to us if you have further queries.
Regards,
Vignesh Natarajan
Vignesh Natarajan
BR
Brian
July 10, 2020 08:15 AM UTC
Hi team,
The last sample project you provided got console error when upgraded to v18.2.0.44.
It's the DropDownList template at last column, when selecting new value and click Update button on the toolbar, it works fine, but if I press enter directly, console error pops up. You can see the screenshot attached. The sample project I provided is basically the same as the last one from you, except including necessary changes for new "ValidationRules" class and "@bind-Value" in template.
Please check for that.
Attachment: SyncfusionBlazorGirdIssue_7f67a273.rar
VN
Vignesh Natarajan
Syncfusion Team
July 14, 2020 06:42 AM UTC
Hi Brian,
Query: “when selecting new value and click Update button on the toolbar, it works fine, but if I press enter directly, console error pops up. You can see the screenshot attached”
We are able to reproduce the reported issue at our end too. The reported issue has occurred due to delayed interop call initiated by dropdown control, this will not affect any functionality of Grid or DropDownList.
But we have confirmed it is a bug and logged the defect report “Script error is thrown when pressing the enter key while editing a record and focus is on DropDownList control” for the same. Thank you for taking the time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our upcoming 2020 Volume 2 Service Pack release which is expected to be rolled out by end of this month (July 2020).
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
Till then we appreciate your patience.
Regards,
Vignesh Natarajan
BR
Brian
July 14, 2020 09:11 AM UTC
Thanks, I'll follow that.
VN
Vignesh Natarajan
Syncfusion Team
July 15, 2020 06:00 AM UTC
Hi Brian,
Thanks for the update.
Kindly follow our Syncfusion site for release related updates.
Please get back to us if you have further queries.
Regards,
Vignesh Natarajan
SIGN IN To post a reply.