petal_components
petal_components copied to clipboard
Table with stream clears upon update
Hi, Trying the Table component (v 1.9.0) but it clears all shown values upon update (yes I put the phx-update="stream" that's missing from the example). it seems that the <:col> has no id but how can I specify the field from the stream in the table's row_id ?
Thanks
hmm. did you try the row_id attribute? Looks like I need to update the doc.
<.table
id="users"
rows={@streams.users}
row_click={fn {_id, user} -> JS.navigate(~p"/users/#{user}") end}
row_id={fn {_id, user} -> "user--#{user.id}" end}
>
Here is the code: https://github.com/petalframework/petal_components/blob/main/lib/petal_components/table.ex
I used the phx generator as a base and adapted it to Petal.