Incorrect dataContext is passed in `onSave` callback using composite editor
Closed this issue · 6 comments
Describe the bug
The dataContext
property (third argument of the onSave
callback on CompositeEditorOpenDetailOption
) has the values of an existing row from the grid, instead of containing the new values that were entered using the composite editor.
Reproduction
The dataContext
appears to contain correct values after the first time of using it.
On the second and all subsequent attempts to use it, dataContext
appears to contain the data of the row above/before the currently active cell of the grid.
Expectation
dataContext
argument should contain the data that were entered in the composite editor dialog.
Environment Info
Angular ^16.2.0
angular-slickgrid ^6.6.4
@slickgrid-universal/composite-editor-component ^3.7.1
Validations
- Follow our Code of Conduct
- Read the HOWTO - Quick Start.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.
I cannot reproduce this on my side, the Example 30 already has console log on the onSave
and editing a single row (from Action menu "Edit Row" on the right), everything seems fine by me. Below is the live demo with editing 2nd row then 4th row and finally the 5th row, then you can see in the console that the data context is correct
Note that I have now published v7.0 a couple days ago and therefore I stopped supporting v6.x.
I've reproduced using the demo page, here I've just added "Task 102" but the data context has "Task 99":
The issue occurs when creating new items in the grid, rather than editing existing items. I may be misinterpreting the purpose for the onSave
arguments mind you - I was using dataContext
because I do not see any values passed in the first argument (formValues
), but perhaps the dataContext means something different than what I was expecting?
ahhh ok I can take a look at the insert, I actually never used it even though I added the feature. I have Cypress test for that feature but only for 1 insert which is probably why I didn't catch this issue.
Thanks for looking at that, and for the work you are open-sourcing with this project!
For my own use case, I think I will move away from using the composite editor and implement dialogs separately, just to have more control over the behaviour. The great thing is there sees to be plenty of flexibility to do that.
I pushed a fix in Slickgrid-Universal as referenced in the link above, this will be released in a couple days but will only be available for v7.x since I don't want to support older versions of Angular-Slickgrid/Slickgrid-Universal (it's too much work for a sole developer like me on these open source projects)
closed by #1337