cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mahmoodhsaud
Helper IV
Helper IV

How to hide a Column in datatable when a button is pressed

In a data table, I wanted to hide a couple of columns when the screen is loaded and the columns should be only visible when a button is pressed.

 

Thanks in Advance,

 

 

Regards,

Mahmood

2 ACCEPTED SOLUTIONS

Accepted Solutions
CNT
Community Champion
Community Champion

@mahmoodhsaud In the OnStart of the App put this,

UpdateContext({varShowColumn:false})

 

In the visible property of these columns,

varShowColumn

 

In the OnSelect of the Button,

UpdateContext({varShowColumn:true})

 

Hope this helps!

 

Please remember to give a 👍 and accept the solution as it will help others in the future.

View solution in original post

CNT
Community Champion
Community Champion

@mahmoodhsaud Oops! that's right. Put this in the OnVisible of u'r screen
UpdateContext({varShowColumn:false})
The variable should be initialised to false every time u navigate to this screen. Just put varShowColumn in the Text property of a Label in u'r screen to be sure it is false when the Screen becomes visible.

Remember Context variables work in the context of a Screen. If you want this variable in different screens, use global a variable,

Set(varShowColumn, true)

View solution in original post

5 REPLIES 5
CNT
Community Champion
Community Champion

@mahmoodhsaud In the OnStart of the App put this,

UpdateContext({varShowColumn:false})

 

In the visible property of these columns,

varShowColumn

 

In the OnSelect of the Button,

UpdateContext({varShowColumn:true})

 

Hope this helps!

 

Please remember to give a 👍 and accept the solution as it will help others in the future.

View solution in original post

Hi @CNT 

 

Thanks for your inputs, but it's showing the 'updatecontext' cannot be used in the property of the app object.

I tried it in Onvisible property of the screen, it is working but the variable is not reverting back to false when the app is starting again

CNT
Community Champion
Community Champion

@mahmoodhsaud Oops! that's right. Put this in the OnVisible of u'r screen
UpdateContext({varShowColumn:false})
The variable should be initialised to false every time u navigate to this screen. Just put varShowColumn in the Text property of a Label in u'r screen to be sure it is false when the Screen becomes visible.

Remember Context variables work in the context of a Screen. If you want this variable in different screens, use global a variable,

Set(varShowColumn, true)

View solution in original post

mahmoodhsaud
Helper IV
Helper IV

Thanks @CNT .. Its working

CNT
Community Champion
Community Champion

@mahmoodhsaud Glad to help!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,175)