q-table selected array don't update
-
Hi!
I use quasar q-table with selected rows
<q-table
color=“primary”
:data=“serverData”
:columns=“columns”
row-key=“uuid”
@request=“request”
:loading=“loading”
:selected.sync=“selected”
selection=“multiple”
:pagination.sync=“serverPagination”
>
…
selected is defined as:
export default {
data () {
return {
…
selected: []
}
}
The table is updated every 10 seconds and the data in it can change. If I select some rows and after that the table is updated, then old data will remain in selected.
Why it happens? After all, sync implies two-way communication
How to solve this problem?thank
-
If the data of the table changes, should it be assumed that the formerly selected values not be kept “alive”, if those same values are still there? In other words, if they are the same row values, why not leave them selected?
If you want to “unselect” the rows, just empty the
selected
array, when you do the update.However, that would seem like bad UX to me, because if I am making a decision to select rows and it takes more than 10 seconds, my selections would happen to disappear on me. That would get a WTF? out of me.
Scott
-
@s-molinari said in q-table selected array don't update:
If the data of the table changes, should it be assumed that the formerly selected values not be kept “alive”, if those same values are still there? In other words, if they are the same row values, why not leave them selected?
If you want to “unselect” the rows, just empty the
selected
array, when you do the update.However, that would seem like bad UX to me, because if I am making a decision to select rows and it takes more than 10 seconds, my selections would happen to disappear on me. That would get a WTF? out of me.
Scott
Well said Scott;