Claes Dahlberg
Posts: 0
Joined: Tue Oct 21, 2014 3:40 pm

How to reload a list after navigate to page

I've got a very simple application listing products and a page for adding products. After adding a new product the focus returns to the list page but the new product doesn't get reloaded in the list. It's in the database and shows if I close the app and open up again. Can I in some way trigg a refresh of data when I "Navigate to page"?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How to reload a list after navigate to page

Hi Claes,

If we understand you correctly, you call a service on page Load event, and you tick 'Render all pages in one HTML file (jQuery Mobile multi-page template)' in App Settings. Then just use Page show instead of Load event.

Claes Dahlberg
Posts: 0
Joined: Tue Oct 21, 2014 3:40 pm

How to reload a list after navigate to page

Hi Kateryna, thank you for your reply. I can't understand it though... What I've done is that I've got a list and above that list I've got a button "Add item" and that takes me to another page with some input fields and a submit button. When clicking the submit button I add the data to the database and then "navigate" to the list page but this is not refreshed and the new item is not listed. If I close the app and open it again the new item is in the list. Can I trig a java script to update the list after navigation? Kindest regards Claes

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How to reload a list after navigate to page

Hi Claes,

How do you update this list? Do you use a service to do it? On what event do you call it?

Claes Dahlberg
Posts: 0
Joined: Tue Oct 21, 2014 3:40 pm

How to reload a list after navigate to page

Hi again, the list is populated by a service loading data from a database.
/Claes

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How to reload a list after navigate to page

Hi Claes,

On what event do you call the service?

Claes Dahlberg
Posts: 0
Joined: Tue Oct 21, 2014 3:40 pm

How to reload a list after navigate to page

Hi Kateryna, sorry for my late response.

What I'm doing is to have a list with items. I also have a button for registering new items taking me to another page with item registration. On that page there are input fields and there's a submit button invoking a service to insert the new item with mapping as "before" and navigate back to the items list page after "success".
When I'm going back to the items list I want the new item to show in the list as it does if I close the app and open it again.

Kindest regards

Claes

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How to reload a list after navigate to page

Hi Claes,

You should add on your page with list - "page show" event handler with action - "invoke service" and choose service that populates your list.

See details: http://prntscr.com/52tltj/direct

Regards.

Claes Dahlberg
Posts: 0
Joined: Tue Oct 21, 2014 3:40 pm

How to reload a list after navigate to page

Great, thank you!

Return to “Issues”