cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PPSA
Resolver II
Resolver II

Repeating Table - Collection - Display Mode after "Save"

Hi all,

I have a repeating table type screen and was trying to work out if possible to change each textbox / dropdown to the view display mode after that line has been collected and the new line starts.

I've tried using - Set(dropdowntest,DisplayMode.View) - on the save button but it changes the property on the next line too.

Any suggestions please?

Thanks

PPSA_0-1596717991368.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Great, this should be straightforward then!

 

Add a column for your collect statements, called something like "appCurrentRow"

 

On the initial collect set it equal to true. We can then use this value to set the DisplayMode (Edit Mode) of the controls in the gallery.

 

A simple function should suffice:

If ( ThisItem.appCurrentRow, DisplayMode.Edit, DisplayMode.Disabled )

 

Bonus tip: you can select multiple controls at once and set the property for all of them at once, in the formula bar.

 

Now we'll need to toggle old rows and set it on new rows. Add this function to whenever you're adding the 2nd+ row.

 

UpdateIf ( colName, appCurrentRow, { appCurrentRow : false } )

 

That will set any rows toggle from true to false. Simply set the new rows appCurrentRow to true, after that, and you'll have a mix of enabled and disabled rows.

View solution in original post

6 REPLIES 6
GarethPrisk
Super User II
Super User II

What is the data source of the gallery? Are you getting rows from an external source or using a local collection?

 

A few ways to do this, but depends on what the source of the gallery is.

 

Your formula is getting a variable which applies to all rows of the gallery. Instead, you'll need to base it on the row itself using ThisItem or referencing a sibling controls value/property.

Hi @GarethPrisk .

Source is a collection,

When opening the page I create the collection with blanks to show the first line,

My save button patches the inputs to the collection and then collects another set of blanks for the next line to appear.

Great, this should be straightforward then!

 

Add a column for your collect statements, called something like "appCurrentRow"

 

On the initial collect set it equal to true. We can then use this value to set the DisplayMode (Edit Mode) of the controls in the gallery.

 

A simple function should suffice:

If ( ThisItem.appCurrentRow, DisplayMode.Edit, DisplayMode.Disabled )

 

Bonus tip: you can select multiple controls at once and set the property for all of them at once, in the formula bar.

 

Now we'll need to toggle old rows and set it on new rows. Add this function to whenever you're adding the 2nd+ row.

 

UpdateIf ( colName, appCurrentRow, { appCurrentRow : false } )

 

That will set any rows toggle from true to false. Simply set the new rows appCurrentRow to true, after that, and you'll have a mix of enabled and disabled rows.

View solution in original post

Thank you, @GarethPrisk .

Works perfectly.

LooseChippings
Advocate II
Advocate II

Hi @PPSA

 

Not a direct answer to your query but I have a similar gallery and my approach was to make only the item selected editable:

LooseChippings_0-1596799413156.png

using If(ThisItem.IsSelected, DisplayMode.Edit, DisplayMode.View) for each of the input fields.

I like the approach, @LooseChippings , if selecting a row means it should be editable. If you need to keep a row locked after a certain point, then the data-oriented approach allows this.

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

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (73,321)