on 2024 Sep 25 10:27 AM
Hi everyone,
I am working on a Mobile Development Kit (MDK) project, and I need some guidance on refreshing a page when navigating via the side drawer.
Here's the scenario: I want the target page to refresh automatically when a user selects a page from the side drawer. I tried adding a refresh action in the OnSuccess event of the NavigationAction. However, this seems to refresh the previous page (the one before navigation), not the target page.
The strange part is that this same approach works for other navigations (like selecting an entry in an Object Table), but it doesn’t seem to work for the side drawer navigation. Has anyone faced this issue or found a solution for refreshing the target page on side drawer navigation?
Any suggestions or alternatives to get this working would be greatly appreciated.
Thanks in advance!
Here’s the code I’m using to refresh the page:
export default function Refresh_page(clientAPI) {
var page = clientAPI.getPageProxy();
var mypage = '#Page:' + page._page.id
alert(mypage)
clientAPI.evaluateTargetPath(mypage).redraw();
return;
}
Request clarification before answering.
Hi Bill, I can provide more details and screenshots to explain my use case, which will help you understand it better. I have a page called 'Delivery List,' which is my first page and triggers all the related functions during the page load. On this page, I have a count and a log icon, both of which should update dynamically whenever there is a change in the item count or any error logs. This works fine on the Delivery page, but it’s not updating on the Customer page. I tried using data subscriptions and added the entity, but the Customer page(Inactive Page) is still not refreshing when the entity changes. As an alternative, I found that navigating to a new page and refreshing it upon opening causes all mapped rules to be recalled and updates the UI accordingly (e.g., the count and the log icon color changing to red when a log is present). This approach works fine for all pages where I use a redraw on successful navigation, except for the 'Customer List' and 'Delivery List.' Here, navigation happens via the side drawer, and the previous page is refreshed. For example, when navigating from the Customer page to the Delivery page, the Customer page gets refreshed. Ideally, the Delivery page should be refreshed to update the rules and UI. Because of this, even though the count is 0, the UI is not updating. I’ve attached a screenshot which will help explain this better.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The thing to remember is that each drawer is it's own navigation stack. Meaning if you open Customers and then go back to Deliveries when you come back to Customers it isn't really navigating to the page. The page was still "open" in memory and it is switching back to the drawer stack. This is observed if you navigate to a customer detail page for example and then switch to Deliveries and then back you will still be on the Customer Detail page. You can change this by setting ClearHistory to true which forces the drawer to reload back to the starting point when switching . It will depend on your use case and desired behaviors.
User | Count |
---|---|
34 | |
22 | |
16 | |
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.