Skip to content
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

TreeView not marking saved value #2021

Open
mkrecek234 opened this issue Mar 10, 2023 · 6 comments
Open

TreeView not marking saved value #2021

mkrecek234 opened this issue Mar 10, 2023 · 6 comments
Labels

Comments

@mkrecek234
Copy link
Contributor

Steps to reproduce:

  • You have a form with a TreeView linked to a field, say article_group_id
  • You edit an entity in the form, select a valid entry of the TreeView
  • You click "Save"
  • The record is saved propery, including the article_group_id
  • You open/reload the edit form completely, showing the same record.

Issue:

  • The TreeView does not mark the currently selected entry/article_group_id

Expected behaviour:

  • The correct selected value inside the tree is marked with a black bullet.

This worked properly prior the latest develop commits

@mvorisek
Copy link
Member

TreeView needs a Behat test to prevent breaking it in the future again.

@mkrecek234
Copy link
Contributor Author

Strange but working again without a change on Atk4 side as it seems, closing this issue

@mvorisek
Copy link
Member

Thank you for the feedback.

@mvorisek mvorisek removed their assignment Mar 15, 2023
@mkrecek234
Copy link
Contributor Author

mkrecek234 commented Mar 16, 2023

I identified the issue which persists. Once again, it is a result of all id typecasting which is being done incorrectly, as an integer is passed to the vue component as a typecasted value with thousand separator. @mvorisek
I believe we should think about getting rid of this, as $model->idField as integers normally should never be typecasted with thousandSeparators. ThousandSeparators is a UI topic ONLY and should ideally only affect displayed values to the customers, whereas any data layer below is not affected by that. @mvorisek

@mkrecek234
Copy link
Contributor Author

Also if I do not find the time yet to provide your requested behat tests, here is the essence of the issue after further analysis:

  • The input field contains the typecasted id of the selection, e.g., id= 1.750 if you have a thousandSeparator .
  • Even if you ensure that all treeItems ids are ALSO typecasted, the Vue TreeItemSelector is not capable if marking the selected item correctly, as it cannot treat ids like 1.750 as they are no longer integers, even though they match the input field.

Consequence: TreeItemSelector requires a proper integer idfield, so current typecasting logic implemented will break this View if you have a thousandSeparator set. The only working workaround is #2022 , otherwise we have to change the logic how id fields are typecasted (or not) on hidden system fields in HTML.

@mvorisek
Copy link
Member

About your 2nd point - why? please point to vue code, as ID can be a string like UUID or any other string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants