cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

Data Table losing focus causing OnSelect function to take two clicks to fire

I have a screen with a Data Table (call it "Screen 1") where I have an OnSelect function on one of the Columns that navigates to another screen ("Screen 2") that displays details about the selected record.  I have a "Back" button on Screen 2 that allows you to navigate back to Screen 1.  The OnSelect function works perfectly when Screen 1 first loads, but once I navigate away to Screen 2 and then hit the back button to get back to Screen 1, it now takes two clicks on the Data Table to fire the OnSelect function.  It's like the Data Table loses focus.  If I click anywhere on the Data Table and then click one of the rows, it will navigate to Screen 2, but it's odd that it takes the second click in order to do that.  What's even weirder is that it works fine in the PowerApps previewer, but doesn't work once published and launched.

3 REPLIES 3
Resolver III
Resolver III

OK, so I have setup a very primitive version of what I think you have.

 

So a screen called Screen5, not that that matters. With a DataTable hooked up to a SharePoint List with OnSelect of the first column configured

 

HenryARPhillips_0-1614120066021.png

 

I click an entry which takes me to screen6, that has a back icon, configured as Back() and a DisplayForm, set to the same DataSource as the DataTable on screen5 and the item of the Form set to

HenryARPhillips_1-1614120147677.png

 

I click the back icon and am able to immediately click another item and it will keep going with one click. So unless there is something fundamentally different in your setup, we should be safe to say that it should work how you want it.

Now things I would check are conflicting controls. So for example the other day I had working visible controls just disappear on me and in the end I had to ensure that whilst that control was present, the other controls were not visible for the controls to remain consistently. So definitely check that.

Also and it pains me too, but that previewer is handy but should never be taken as gospel as that has done me over many a time with appearing to work as I would want it to, only to do something completely different when coming to run the app for real 😞

 

 

Thanks for looking into this!  It helped me to do some more digging on my end too.  The data source that I'm using for my Data Table is SQL based, so that got me wondering if that could be making a difference.  And sure enough, it seems to be the case.  I replicated your test by using a SharePoint list as the data source: lo and behold, it works exactly as expected and as you've described.  Then, if I take those same controls (Data Table on one Screen 1 and a Display Form on Screen 2) and link them to my SQL data source, it malfunctions as I've described.

 

The other weird thing is that when the app first loads to Screen 1, it only takes one click to navigate to Screen 2 - it's only when I've returned to Screen 1 a second time that it takes two clicks to fire the OnSelect function.  And I don't even have to click the same row twice.  I could click anywhere in the table and then click a different row, and it will Select the row of my second click.  That's what got me thinking about focus, because it seems like the first click somehow re-focuses the Data Table and the second click then works as intended.

 

Also, I double checked my test by changing back to the SP list (and the expected/desired functionality returned) and then changed back again to the SQL table (and the malfunction returned).  I'm not sure why the source of the data would make a difference here.  Any thoughts on why that might be the case?

 

Thanks again!

Resolver III
Resolver III

Hi,

I actually have one of those up my sleeve but cannot show due to containing customer data.

 

However when I checked that works fine.

At first I thought it might have been because I have a New and Edit button above the Table that you click to then do some logic based on the selected item. So I set the same logic in the on click of one of the columns and when coming back it was immediately selectable.

I then thought was it because on the loading of the screen that hosts the data table I do a refresh of the data source but removing that, it still worked.

So the only possible difference but not sure why it would make a difference is my table in Power Apps is technically a SQL view and not a straight table.

Other suggestion, is to try bringing the data table to the front of the screen.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (66,108)