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

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 III
Helper III

Thanks @CNT .. Its working

CNT
Community Champion
Community Champion

@mahmoodhsaud Glad to help!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

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

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,430)