Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Conditionally show columns #413

Answered by huangshuwei
ThisuraThejith asked this question in Q&A
Discussion options

I have used vue-easytable plugin version 2.8.2 to display a table inside a Vue component. I have a problem of finding how to conditionally display a table column.

In the demo displayed in here when either of the "Row Radio" or "Row Checkbox" switches are switched on we can see a column is added to the demo table dynamically. So I think this feature/functionality should be there already in the plugin but I couldn't find how to achieve this referring to the documentation.

Within my Vue component the columns array I pass to vue-easytable is as follows.

columns: [ { field: "entity", key: "c", title: "Entity", align: "left", sortBy: "asc", }, { field: "version", key: "d", title: "Version", align: "center", }, { field: "test_date", key: "e", title: "Test Date", align: "center", }, { field: "score", key: "f", title: "Score", align: "center", }, { field: "score_percentage", key: "g", title: "Score (%)", align: "center", }, { field: "result", key: "h", title: "Result", align: "center", } ]

I want to show the "Entity" column when a condition is satisfied. What should I do to achieve that?

You must be logged in to vote

In this example, I implemented it through computed. You can refer to this file for specific code implementation .

Replies: 2 comments 3 replies

Comment options

In this example, I implemented it through computed. You can refer to this file for specific code implementation .

You must be logged in to vote
1 reply
Comment options

Thanks a lot @huangshuwei.

Answer selected by ThisuraThejith
Comment options

I am also considering whether to add some APIs to support the hidden column feature

You must be logged in to vote
2 replies
Comment options

It would be great if you guys could do that @huangshuwei . You guys have done a great job already by implementing vue-easytable. Keep up the great work.

Comment options

Hi, The new version adds column hidden feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /