0

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.