cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Formating a list to look like a data table

Here's the situation:
I have a large sharepoint list that I'd like to browse through. I considered using Data Tables, but the problem is I have to actually select one to several elements and do things with those. Thus I consider the List Control to be what I'm looking for. Is there a way to include several fields of my Sharepoint list inside the same list control in powerapps ? I only ever manage to make 1 appear.
TL;DR: Is there a way to browse through a data table and select several elements from it ? (Much like Excel)

1 ACCEPTED SOLUTION

Accepted Solutions
CarlosFigueira
Power Apps
Power Apps

You currently cannot format a list to look like a data table, nor can have multiple selections in a data table (please create a new feature request in the PowerApps Ideas board for those features, or vote one up if it already exists).

There are a few alternatives you can use. I've attached an app to this answer that shows those - to open it, save it locally, then go to https://create.powerapps.com, select Open, Browse, then find the file that you saved previously.

If you are ok with a simple text version of all the columns that you want to display, you can use the AddColumns function in the Items property of the list box control to add a new column that will have the columns that you want. For example, if this is your data source:

ClearCollect(
    ScoobyDoo,
    {Id:1, Name:"Scooby Doo", Age:7, Human:false},
    {Id:2, Name:"Shaggy Rogers", Age:17, Human:true},
    {Id:3, Name:"Fred Jones", Age:17, Human:true},
    {Id:4, Name:"Daphne Blake", Age:16, Human:true},
    {Id:5, Name:"Velma Dinkley", Age:15, Human:true},
    {Id:6, Name: "Scrappy Doo", Age:3, Human:false })

You can display all three columns in a list by using this expression in the list box Items property:

AddColumns(
    ScoobyDoo,
    "List line",
    Name & " - " & Age & If(Human, " (human)"))

And choosing the new column ('List line') as the value to display in the list.

If you want more control over how the individual columns are displayed in each row, then you can use a gallery control. To emulate be able to show the selection when a user clicks on a row, you will need to add an additional column (which in my example I called 'ItemSelected') so that we can toggle it and display it properly. So for the same data source, I created a second collection, with the items unselected by default:

ClearCollect(
    ScoobyDooWithSelection,
    AddColumns(
        ScoobyDoo,
        "ItemSelected",
        false))

And used this new collection as the gallery's Items property. Now we can set the gallery's TemplateFill property to display a different color depending on the selection:

If(
    ThisItem.ItemSelected,
    RGBA(0, 127, 255, 0,2),
    RGBA(0, 0, 0, 0))

And finally set the OnSelect property of each of the labels inside the gallery to toggle the ItemSelected property when clicked:

Patch(
    ScoobyDooWithSelection,
    ThisItem,
    { ItemSelected: Not ItemSelected })

Try playing with the attached app, hopefully this will help you, and let us know if you have any questions!

View solution in original post

1 REPLY 1
CarlosFigueira
Power Apps
Power Apps

You currently cannot format a list to look like a data table, nor can have multiple selections in a data table (please create a new feature request in the PowerApps Ideas board for those features, or vote one up if it already exists).

There are a few alternatives you can use. I've attached an app to this answer that shows those - to open it, save it locally, then go to https://create.powerapps.com, select Open, Browse, then find the file that you saved previously.

If you are ok with a simple text version of all the columns that you want to display, you can use the AddColumns function in the Items property of the list box control to add a new column that will have the columns that you want. For example, if this is your data source:

ClearCollect(
    ScoobyDoo,
    {Id:1, Name:"Scooby Doo", Age:7, Human:false},
    {Id:2, Name:"Shaggy Rogers", Age:17, Human:true},
    {Id:3, Name:"Fred Jones", Age:17, Human:true},
    {Id:4, Name:"Daphne Blake", Age:16, Human:true},
    {Id:5, Name:"Velma Dinkley", Age:15, Human:true},
    {Id:6, Name: "Scrappy Doo", Age:3, Human:false })

You can display all three columns in a list by using this expression in the list box Items property:

AddColumns(
    ScoobyDoo,
    "List line",
    Name & " - " & Age & If(Human, " (human)"))

And choosing the new column ('List line') as the value to display in the list.

If you want more control over how the individual columns are displayed in each row, then you can use a gallery control. To emulate be able to show the selection when a user clicks on a row, you will need to add an additional column (which in my example I called 'ItemSelected') so that we can toggle it and display it properly. So for the same data source, I created a second collection, with the items unselected by default:

ClearCollect(
    ScoobyDooWithSelection,
    AddColumns(
        ScoobyDoo,
        "ItemSelected",
        false))

And used this new collection as the gallery's Items property. Now we can set the gallery's TemplateFill property to display a different color depending on the selection:

If(
    ThisItem.ItemSelected,
    RGBA(0, 127, 255, 0,2),
    RGBA(0, 0, 0, 0))

And finally set the OnSelect property of each of the labels inside the gallery to toggle the ItemSelected property when clicked:

Patch(
    ScoobyDooWithSelection,
    ThisItem,
    { ItemSelected: Not ItemSelected })

Try playing with the attached app, hopefully this will help you, and let us know if you have any questions!

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Users online (2,396)