havit / Havit.Blazor

Free Bootstrap 5 components for ASP.NET Blazor + optional enterprise-level stack for Blazor development (gRPC code-first, layered architecture, localization, auth, ...)
https://havit.blazor.eu
MIT License
475 stars 66 forks source link

[doc] HxGrid - Inline editing - incorrect code sample #759

Closed hakenr closed 5 months ago

hakenr commented 6 months ago

Hello @bluisanajmr, our demo https://havit.blazor.eu/components/HxGrid#inline-editing is not correct, the selectedDataItem in HandleSelectedDataItemChanged is not the original row changed, but the new row selected. The whole demo "works" only as the DemoDataService holds the instances of employees in memory and these instances are being changed by the input-components binding.

I will adjust the demo to demonstrate the correct approach mentioned in my previous comment. The approach you chose is also applicable but it does save changes on every single input-component change, not the row as a single change.

Another possibility is to add a "Save" button to the row and make it visible only when the row is being edited. Clicking the Save button will save the data and set the selectedDataItem to null to disable editing.

Originally posted by @hakenr in https://github.com/havit/Havit.Blazor/discussions/757#discussioncomment-8583983