Closed chenxingyu9 closed 5 years ago
Hi @chenxingyu9 ,
Currently, this option is unavailable. But this is a valid request because in some scenarios users want to show the table with preselection.
I will consider this as a feature request and try to implement this on the upcoming release. If you've any other suggestions on how this could be done, please comment here.
Cheers, Ruby.
Hi @chenxingyu9
Now you can target a specific row using data-id
attribute attached with all the <tr>
element.
You can specify the uniqueId
in the column configuration which you want to use for data-id
attribute.
columns: [{
label: "id",
name: "id",
sort: true,
uniqueId: true,
visibility: true
},
...
]
Now your row will have the data-id
attribute with the id value from the given data.
Then, you can trigger a click event on the specific rows to select.
Example one:
$('[data-id="17"] .vbt-checkbox').click()
Example two:
If your table doesn't have checkbox but only row selection you can use,
$('[data-id="17"]').click()
Cheers, Ruby.
Eg: I have 5 items already in the table but I wanted to target row 2 or multiple rows ticked explicitly without clicking the row using id or other reference? Thanks.