I've encountered a common scenario where I need to display data from a REST service in a table using Vue, but I'm struggling to find examples on how to make it work.
When fetching a list of users and showing them in a table, I face an issue with adding a "checked" attribute dynamically. Here's a simplified version:
<tr v-for="guser in filteredUsers" class="group_user">
<td><input type="checkbox" v-bind="guser.checked"></td><td>{{guser.username}</td>
</tr>
The problem arises from the fact that the "checked" attribute is not part of the user object retrieved from the backend. Therefore, I need to add it on the client side after fetching the data. This approach makes sense since the backend doesn't need to know about this frontend functionality.
However, I'm facing difficulties with the binding of v-bind="guser.checked". It seems that any attribute bound to a form control needs to be predefined when declaring the objects. But how can I achieve this for a dynamic list of N objects received from the server?
If anyone has advice or insights on this matter, I would greatly appreciate it. Thank you!