Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Details List Default row not being selected when app loads #461

Open
KeithHR opened this issue Apr 30, 2024 · 9 comments
Open

[BUG]: Details List Default row not being selected when app loads #461

KeithHR opened this issue Apr 30, 2024 · 9 comments
Assignees
Labels
bug Something isn't working code Issue is related to a Power Apps code component Component: DetailsList

Comments

@KeithHR
Copy link

KeithHR commented Apr 30, 2024

Describe the bug
I have a details list in an embedded canvas app. I have set the RecordSelected property to true and have set input event to "SetSelection"&Text(Rand()) however when the app loads the row is not being selected by default.

To Reproduce
Steps to reproduce the behavior:

  1. Add details list in embeded canvas app
  2. Set RecordSelected field to true in 'Records' property in details list
  3. Set input event to "SetSelection"&Text(Rand())
  4. Play your MDA and open the embedded canvas app

Expected behavior
Every record that has RecordSelected set to true should be selected when app loads

AB#3081

@KeithHR KeithHR added bug Something isn't working ⚠️ needs triage Has not been triaged by the team yet. labels Apr 30, 2024
@denise-msft denise-msft added this to the Creator Kit - May 2024 milestone May 1, 2024
@KeithHR
Copy link
Author

KeithHR commented Jun 3, 2024

Hello, checking in to see if this has been reviewed?
Thanks.

@denise-msft
Copy link
Member

Hi @KeithHR, Is the detailsList prop SelectionType set to multiple?

@denise-msft denise-msft added code Issue is related to a Power Apps code component Component: DetailsList and removed ⚠️ needs triage Has not been triaged by the team yet. labels Jun 13, 2024
@denise-msft denise-msft self-assigned this Jun 13, 2024
@KeithHR
Copy link
Author

KeithHR commented Jun 14, 2024

Hi @KeithHR, Is the detailsList prop SelectionType set to multiple?

Hi @denise-msft, I have tried to set it to multiple and it does work for either single or multiple. I would like to have one row in the list be selected by default when a user clicks on the tab to open the app(the list is located on the home screen). The problem seems to be that it will only register the default row if I navigate to a different screen and then navigate back to the home screen where the list is located.

@denise-msft
Copy link
Member

Just to clarify, what do you mean by an embedded app? is this embedded in SharePoint, a model driven app as a component, as a custom page as part of a model driven app, or something else?

Also, regarding how the behavior works when you navigate back to the screen - where are you updating the collection, Screen.OnVisible? If you were to display the values of RecordSelected, would the correct values populate the table, and the event behavior is the only thing that's not working? Or are the values not getting updated in the collection on the first load? Is there a way you can please confirm the data is correct on first load?

@KeithHR
Copy link
Author

KeithHR commented Jun 24, 2024

Just to clarify, what do you mean by an embedded app? is this embedded in SharePoint, a model driven app as a component, as a custom page as part of a model driven app, or something else?

  • This is a canvas app that is embedded in a model driven app

Also, regarding how the behavior works when you navigate back to the screen - where are you updating the collection, Screen.OnVisible? If you were to display the values of RecordSelected, would the correct values populate the table, and the event behavior is the only thing that's not working? Or are the values not getting updated in the collection on the first load? Is there a way you can please confirm the data is correct on first load?

  • I have logic within the Records property of the Details List that will change an item to true which should trigger the row to be selected (so it is not a variable, just an IF statement to check each record). The Details List is located on the first screen. It seems like the value is not getting updated on the first load.

When I first select the tab that the canvas app is on:
image

While using the canvas the app, if I navigate back to the Details List:
image

@denise-msft
Copy link
Member

Just to clarify, what do you mean by an embedded app? is this embedded in SharePoint, a model driven app as a component, as a custom page as part of a model driven app, or something else?

  • This is a canvas app that is embedded in a model driven app

Also, regarding how the behavior works when you navigate back to the screen - where are you updating the collection, Screen.OnVisible? If you were to display the values of RecordSelected, would the correct values populate the table, and the event behavior is the only thing that's not working? Or are the values not getting updated in the collection on the first load? Is there a way you can please confirm the data is correct on first load?

  • I have logic within the Records property of the Details List that will change an item to true which should trigger the row to be selected (so it is not a variable, just an IF statement to check each record). The Details List is located on the first screen. It seems like the value is not getting updated on the first load.

When I first select the tab that the canvas app is on: image

While using the canvas the app, if I navigate back to the Details List: image

Regarding the location of the DetailsList items data source, you're saying that the logic that determines where the RecordSelected is dynamically calculated on the DetailsList.Items property, right?

Can you please share the snippet of code that calculates this so we can try to reproduce the issue?

If there is dependency on variables or objects such as the model driven app integration object (that passes the current form ID into the embedded canvas app), we need to know that and the formula calculating this so we can ensure the expected values are dynamically calculating at every state.

@KeithHR
Copy link
Author

KeithHR commented Aug 30, 2024

Regarding the location of the DetailsList items data source, you're saying that the logic that determines where the RecordSelected is dynamically calculated on the DetailsList.Items property, right?

Yes that is correct.

Can you please share the snippet of code that calculates this so we can try to reproduce the issue?

Here you go.

To reproduce you will need to embed a canvas app in a model driven app.

Variable:
Located on First Screen, onVisible:
Set(
varRoleTypeIsNotBlank,
!IsBlank([@'Role Type'])
);

DetailsList -> Items:
AddColumns(
//Filter records to only show active roles and roles that are not blank
Filter(
Roles,
Customer = ModelDrivenFormIntegration.Item.Customer && Status = 'Status (Roles)'.Active && varRoleTypeIsNotBlank = true
),
AgreementNumber,
Agreement.'Agreement Number',
AgreementStatus,
Agreement.'Agreement Status',
AgreementProductClass,
Agreement.'Product Class',
AgreementGuid,
Agreement.Agreement,
//added company to be used in Send Form button URL
Company,
Agreement.Company,
ID,
Agreement.'Agreement ID EDW',
//Assuming restriction code is on agreement table, Pull in Agreement restriction code so it can be used
AgreementRestrictionCode,
Agreement.'Agreement Restriction Code',
'Source Restriction Reason',
Agreement.'Source Restriction Reason',
RecordSelected,
If('Role Type' = [@'Role Type'].Owner, true,false)
)

DetailsList -> Input Event:
"SetSelection"&Text(Rand()) -> (I have also tried "SetSelection")

@denise-msft
Copy link
Member

Thanks for sharing this, we are working on a repro.

Is Role Type a Dataverse option set column on the table Roles ? And are the correct values populated in those rows on first launch? Have you confirmed by displaying the value on the screen in some form (e.g., a row in the DetailsList) ?

@KeithHR
Copy link
Author

KeithHR commented Aug 30, 2024

Yes that is correct and yes the option set data is there and loads correctly
thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working code Issue is related to a Power Apps code component Component: DetailsList
Projects
None yet
Development

No branches or pull requests

2 participants