cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JACK_LAI_1117
Helper V
Helper V

why my page auto refresh data from collection

In my datatable has two record and the item come from collection “ opselectcasedata"

 

JACK_LAI_1117_0-1623650309561.png

 

After user click “request id “ then will navigate to another page

 

JACK_LAI_1117_1-1623650363996.png

 

The user can modify any item data , like “reason request” or “vat type” …….then user will click “Save “ button then navigate to previous page .

 

After click “Save “ , weird things happened …….the page will transfer show first record in that collection .

 

This is the code in my “Save” button , so what’s wrong with my code ??

JACK_LAI_1117_2-1623650384234.png

JACK_LAI_1117_3-1623650393963.png

JACK_LAI_1117_4-1623650404143.png

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
gabibalaban
Dual Super User
Dual Super User

@JACK_LAI_1117 ,

I guess all your controls in the second screen had Default property set to Gallery.Selected. .....

When you modify the source (collection) of the Gallery, the gallery itself resets to show you the new values (even this is happen in another screen). Or after reset the default selected item of a gallery is the first item. That's why all your controls from the second screen shows the values of the first item of collection.  

To solved it use a global variable:

Gallery.OnSelect -> Set(itemSelected, LookUp(opselectcasedata,requestID=Gallery.Selected.requestID))

 

In Default property of the second screen use itemSelected instead on Gallery.Selected.

And finally add to Save button -> OnSelect after your code:

Set(itemSelected, LookUp(opselectcasedata,requestID=itemSelected.RequestID))

 

Hope it helps !

 

View solution in original post

2 REPLIES 2
gabibalaban
Dual Super User
Dual Super User

@JACK_LAI_1117 ,

I guess all your controls in the second screen had Default property set to Gallery.Selected. .....

When you modify the source (collection) of the Gallery, the gallery itself resets to show you the new values (even this is happen in another screen). Or after reset the default selected item of a gallery is the first item. That's why all your controls from the second screen shows the values of the first item of collection.  

To solved it use a global variable:

Gallery.OnSelect -> Set(itemSelected, LookUp(opselectcasedata,requestID=Gallery.Selected.requestID))

 

In Default property of the second screen use itemSelected instead on Gallery.Selected.

And finally add to Save button -> OnSelect after your code:

Set(itemSelected, LookUp(opselectcasedata,requestID=itemSelected.RequestID))

 

Hope it helps !

 

JACK_LAI_1117
Helper V
Helper V

@gabibalaban 

 

Yes , all the second page the default property is to to gallery.selected.....

 

So I will modify my code to use your method .

 

Thank you very much ~~

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,811)