Skip to content
Advertisement

How to make this table sort by this particular column when it initially loads?

I have a bootstrap-vue table that looks like this;

enter image description here

Here’s the code;

JavaScript

When this table is initially loaded up, I want to specify that the table is sorted according to Person age column in descending order.

I am using bootstrap-vue and Vue v2.6

Advertisement

Answer

You can use these two attributes in <b-table> :

JavaScript

Demo :

JavaScript
JavaScript

—- OR ——

You can bind these attributes dynamically from data property as well with the .sync option.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement