Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

Power Apps Data Table Default Select Row

Do you know about the Power Apps data table default select row? I will show you here how to set the default selected row in a Power Apps data table.

Here, we will discuss how to deselect the Power Apps data table default row and set the Power Apps data table default selected row using text input.

Also, we will see how to set a Power Apps data table default selected row using the SharePoint list.

Power Apps Data Table Default Select Row

Recently, I got an opportunity to work with the Power Apps data table default select row with different scenarios. Such as:

Scenario-1: How to Unselect the Power Apps data table default row

Whenever the user adds a data table in the Power Apps and adds items from different data sources [SharePoint, Excel, Collection, etc…] by default, the data table selects only the first row or record as in the screenshot below.

Power Apps Data Table Default Select Row

Now, I would like to Unselect this default data table row in the Power Apps app when the screen loads the first time. Have a look at the below screenshot for the output.

PowerApps Data Table Default Select Row

To work around this, follow the below-mentioned steps. Such as:

1. Create a Blank canvas app -> Select the App object [From the left navigation] and set its OnStart property to the code below.

OnStart = ClearCollect(
    colEmployeeRegistration,
    {
        Name: "Smith John",
        Email: "smithjohn56@gmail.com",
        Designation: "Analyst"
    },
    {
        Name: "Jones Robort",
        Email: "jonesrobort12@gmail.com",
        Designation: "Team Lead"
    },
    {
        Name: "Reema Sean",
        Email: "reemasean142@gmail.com",
        Designation: "Manager"
    },
    {
        Name: "David Jones",
        Email: "davidjones89@gmail.com",
        Designation: "Analyst"
    }
)

Where,

  • colEmployeeRegistration = Power Apps Collection Name
  • Name, Email, Designation = Collection headers/columns
  • “Smith John”, “smithjohn56@gmail.com”, “Analyst” = Collection rows/records
How to deselect the Power Apps data table default row

2. Select the Power Apps Screen and set its OnVisible property as:

OnVisible = Set(varDefaultRow,true)

Where,

  • Set() = We can use this Set() function to create a global variable
  • varDefaultRow = Global variable name
Deselect the Power Apps data table default row

3. Then, insert a Data table and set its Items property -> To display the data table records, click on the Edit filed, and add the respective fields as per needs like below.

Items = colEmployeeRegistration
Unselect the Power Apps data table default row

4. Next, select the Data table and set its SelectedFill property as:

SelectedFill = If(
    varDefaultRow,
    RGBA(
        255,
        255,
        255,
        1
    ),
    RGBA(
        56,
        96,
        178,
        .2
    )
)

Where,

  • If() = This function helps to evaluate the unrelated condition
  • varDefaultRow = Global variable name
Data Table Default Select Row in Power Apps

5. In the last, select each column of the data table and set its OnSelect property to the code below.

OnSelect = Set(varDefaultRow,false)