[Vuejs]-Vue.js element ui bind boolean data to selection column

0👍

If I understood well your question, you have a key property in each of the rows of your tableData3 data. You want to show the user whether the row has been selected or not depending on if key is true or false.

You could do that in the mounted method:

  1. You select the rows to toggle by removing the ones that are false using the array’s filter method.
  2. You toggle these rows using the toggleSelection method
mounted() {
  const rowsToToggle = this.tableData3.filter(row => row.key)
  this.toggleSelection(rowsToToggle)
}

Here is the fiddle with the associated behavior. Hope it help you.

Leave a comment