Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select and Deselect programmatically #82

Open
Phil795 opened this issue Jan 22, 2020 · 2 comments
Open

Select and Deselect programmatically #82

Phil795 opened this issue Jan 22, 2020 · 2 comments

Comments

@Phil795
Copy link

Phil795 commented Jan 22, 2020

A method for programmatically selecting and deselecting lines is missing.

If a line is selected and the data array changes, a line still remains selected even though it no longer exists.

It would be nice if you could implement 2 methods for this.

@Kwaadpepper
Copy link

This is needed because of pagination only selecting visible lines.
Need to select all paginated content.

@Kwaadpepper
Copy link

Kwaadpepper commented Oct 12, 2020

Found a solution, This will work with pagination (local pagination)

You need to attribute a vbt_id manually (used on internal by vue-bootstrap4-table)

Select All

let i = 1, self = this;
_.map(self.rows, function(row) { // used underscore.js (just loop over rows, eg: for of)
    contact.vbt_id = i++;
    self.$refs.vueBootstrap4Table.addSelectedItem(row);
});
this.$refs.groupContacts.allRowsSelected = true; // hack to update main checkbox

Unselect All

let i = 1, self = this;
_.map(self.rows, function(row) { // used underscore.js (just loop over rows, eg: for of)
    contact.vbt_id = i++;
    self.$refs.vueBootstrap4Table.removeSelectedItem(row);
});
this.$refs.groupContacts.allRowsSelected = false; // hack to update main checkbox

This was referenced Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants