-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep row prefix constant when reordering #3176
Keep row prefix constant when reordering #3176
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, what you'd be doing here is "hard-coding" the name row_prefix
. So rowPrefixField
is an optional select field with a dynamic name, and in this case it might be row_prefix
, but in other fields in might be another name, so we'll have to rely on field.rowPrefixField.name
for the prefix field name.
Guess what I'd try instead would be to
- pass down a
rowPrefixFieldname
and maybe therow
itself from the FormConceptGroup to the FormConceptNode - add both to the dragContext
- get them both from the dragContext in dropBetween
- if defined, get the prefix field value from the row + rowPrefixFieldname and pass a modified
newValue
toinsertValue()
Does that make sense?
I just implemented some changes to this PR. Please let me know what you think |
Would that work with concepts dragged in from other fields as well? |
No, but that wasn't possible in the previous version either. If we would allow that we would need to take in the possible values for the prefix into account, wouldn't we? To catch the case of the prefixes having different possible values. |
frontend/src/js/external-forms/form-concept-group/FormConceptGroup.tsx
Outdated
Show resolved
Hide resolved
const modifiedValue = newValue as unknown as { | ||
[index: string]: string; | ||
}; | ||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
puuh, das sieht gut so aus, aber kP ob das bei dir Nebeneffekte hat, die nicht offensichtlich sind.
zB darf newValue mutable behandelt werden?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Danke, da hast du Recht, dass prop sollte so eigentlich nicht geändert werden. Ich habe gerade eine Version gepusht die ein deep copy umsetzt (mit json)
…roup.tsx Co-authored-by: awildturtok <1553491+awildturtok@users.noreply.github.com>
…:ingef/conquery into fix/row-prefix-gets-discarded-on-reorder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabian-bizfactory I've cleaned up some of the logic, check my last commit. Was a bit easier than trying to explain. Looks good otherwise!
No description provided.