Reputation: 651
I've really exhausted all the possible results in google but still can't find the answer. If there is one. I need to do one simple thing: Using Vuejs and Vue-tables-2 (https://www.npmjs.com/package/vue-tables-2), I need to hide one column, depending on if the user is admin or not, of course, before the table is loaded.
I've tried different approaches but without success. I think that the closest one is using computed propierties, but withou success.
I will not copy code since it is really unnecesary, all I've done didn't work and I am at the beginning again.
I really appreciate if someone could help me.
Thank you
Upvotes: 0
Views: 1035
Reputation: 893
From the documentation page it looks like you control what columns are present in the table through an array:
data: {
columns: ['id', 'name', 'age'],
tableData: [
{ id: 1, name: "John", age: "20" },
{ id: 2, name: "Jane", age: "24" },
{ id: 3, name: "Susan", age: "16" },
{ id: 4, name: "Chris", age: "55" },
{ id: 5, name: "Dan", age: "40" }
]
};
Therefore when the page is loaded, you modify the array columns
to add or remove columns from your table dependant on the user type.
Upvotes: 1