Skip to content

Data Table Component : how to hide certain column based on some condition #771

Closed Answered by noxify
shrix1 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @shrix1 ,

i don't know how your filter ( Upcoming, Past, Canceled ) is implemented but let's assume you're using an url parameter to handle the status filter ( e.g. http://localhost/list?status=past ), I see two possible ways to solve this.

Based on the url parameter status you can

  • use a different column list which excludes the View Video/PPT column
  • use the column visibility ( which is documented here and here ) to hide the column.
      const [columnVisibility, setColumnVisibility] = React.useState({
         viewVideoPpt: false, 
      });

Personally, I would prefer option 2.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@shrix1
Comment options

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