cancel
Showing results for 
Search instead for 
Did you mean: 

Gallery Template - add rownumber parameter

In this way you can do a formula on for example the Fill property. Like 

If(Mod(ThisTemplate.RowCount)=1,
	DarkGray,
	White
)

This would make the first line darkgray, the second white, the third darkgray and so on.

 

Status: Under Review

Updating status and adding @GregLi

Comments
Power Apps
Status changed to: Under Review

Updating status and adding @GregLi

Kudo Kingpin

I would like this also. I just want to show the row number on the gallery so a user can know what row he is on. With the virtual scrolling a user has no idea how many rows he has to scroll thru . If I put the rowcount near the header aree of the page and the row # on the details of the gallery the user can know where he is.

Advocate II

Any updates on this?

Regular Visitor

Need it badly... Any news yet, please?

Advocate II

This is really needed - would be great for alternate shading of galleries and a whole bunch of other stuff.

Advocate II

My workaround for this was to generate row id's for my data source by placing them into collections. Once I have a row id on my collection, I can use that to my liking.

Code: 

//Clear final collection to ensure no redundant data
Clear(colWorkers);

//Create a temporary collection for data source
ClearCollect(tempColWorkers, Workers);

//This create a column called row id on your final collection
ForAll(tempColWorkers, 
    Collect(colWorkers, {
        rowid: CountRows(colWorkers)
        //Add your other columns here
    })
)

I placed that on my OnStart so this happens only when my app starts.

Also for the gallery template fill: 

If(Mod(rowid,2)=0, Color.Aqua, Color.AliceBlue)


Samples:

My Workaround.PNGresults.PNG

Advocate V
Advocate V

So many workarounds for something so basic and you call it LOW CODE (what an hypocrisy!)

Advocate II

Hahaha chill brother @CNT 


Frequent Visitor

@ProjectVelox thank you for the workaround. I spent some time trying to figure out how to include data from the other columns in the Workers collection, so I just wanted to include the explicit syntax in case anyone else gets confused like I did 🙂

 

//Clear final collection to ensure no redundant data
Clear(colWorkers);

//Create a temporary collection for data source
ClearCollect(tempColWorkers, Workers);

//This create a column called row id on your final collection
ForAll(tempColWorkers, 
    Collect(colWorkers, {
        rowid: CountRows(colWorkers),
        //Add your other columns here
exampleValue: columnName }) )

Where columnName is a column inside Workers. Now the value can be accessed like:

ThisItem.exampleValue

Inside the colWorkers Gallery.