Altinn / app-frontend-react

Altinn application React frontend
BSD 3-Clause "New" or "Revised" License
14 stars 24 forks source link

ListComponent fails to identify selected row if one of the columns is not `string` #2071

Open bjosttveit opened 2 weeks ago

bjosttveit commented 2 weeks ago

Description of the bug

If one of the columns in a datalist is not a string, f.ex. an int, and this value is saved to the data model through the ListComponent's dataModelBindings. It will never show any row as selected, even if the form data gets populated when a row is clicked. This is because currently, the list component gets its form data casted to string, and compares this with the data in the raw dataList rows, which could contain other types (like integers).

The ListComponent in frontend-test has an integer column, but this value is not stored in the form data, if this value was stored it would not work properly. We should update frontend-test to also store this, and make sure the tests fail if the row is not shown as selected.

bilde

Steps To Reproduce

  1. Define a datalist with at least one integer column
  2. Make sure the ListComponent using this datalist stores the integer value through its dataModelBindings
  3. Observe that clicking a row will not show it as selected, even though dev tools shows that it has the values set

Additional Information

No response