3 weeks ago - last edited 3 weeks ago
Hi,
I have a problem when trying to transfer binding from Action to Page.
When I click on object table row and afterwards navigate directly to a Page, all works fine, the fields on that page show the binding informations.
If i click on the same Object Table but i navigate on a Popup(choose an operation(buttons) that affects the target page) and from Popop to the Page, the Page does not receive the binding from the first action:
Object Table -> OnPress(NavToPopup) -> Press Button on Popup -> OnPress(Initialize and Fetch data) -> NavToShowSalesOrderPage
I tried to use rules in the OnPress event of Popup Buttons but I was unable to transfer the binding.
OnPress Event of Pupup Button(Initialize)
let pageProxy = clientAPI.getPageProxy(); clientAPI.showActivityIndicator(clientAPI.localizeText('Loading')); clientAPI.executeAction("/App/Actions/ClosePage.action"); pageProxy.setActionBinding(pageProxy.getBindingObject()); return clientAPI.executeAction("/App/Rules/CreateSalesOrder/FetchSalesOrder.js");
export default async function FetchSalesOrder(clientAPI) { let pageProxy = clientAPI.getPageProxy(); //get action binding var binding = pageProxy.getActionBinding(); //get client data let appClientData = pageProxy.getAppClientData();
....Fetch Operations...
clientAPI.dismissActivityIndicator(); return clientAPI.executeAction("/App/Actions/ShowSalesOrderActions/NavToShowSalesOrder.action"); }
How I can transfer the binding ?
Thank you.
Request clarification before answering.
i think i found the problem.
Inside FetchSalesOrder.js there is the following code for Fetch all the needed data:
//read items clientAPI.read(servicePath, entitySet, [], query).then((result) => {
appClientData.Items = []; for (let i = 0; i < result.length; i++) { let orderItem = result.getItem(i); appClientData.Items.push(orderItem); } //read texts entitySet = "TextSet"; return clientAPI.read(servicePath, entitySet, [], query); }).then((result) => { appClientData.HeaderTexts = []; appClientData.ItemTexts = []; for (let i = 0; i < result.length; i++) { let orderText = result.getItem(i); if (orderText.Posnr === "") { appClientData.HeaderTexts.push(orderText); } else { appClientData.ItemTexts.push(orderText); } } //read conditions entitySet = "ConditionSet"; return clientAPI.read(servicePath, entitySet, [], query); }).then((result) => { let orderCondition = []; for (let i = 0; i < result.length; i++) { orderCondition.push(result.getItem(i)); } appClientData.PricesCondition = orderCondition.reduce(function (r, a) { r[a.Pos] = r[a.Pos] || []; r[a.Pos].push(a); return r; }, Object.create(null)); }).then((result) => { clientAPI.dismissActivityIndicator(); return clientAPI.executeAction("/App/Actions/ShowSalesOrderActions/NavToShowSalesOrder.action"); }).catch((error) => { return Utility.displayErrorMessage(clientAPI.localizeText('DataReadError', [binding.OrderS])); });
If the clientAPI.executeAction for Navigation in inside the then( ) method of Promise the binding fail to transfer to the next page.
If I copy the executeAction outside like this:
//read items clientAPI.read(servicePath, entitySet, [], query).then((result) => { .......... }).catch((error) => { return Utility.displayErrorMessage(clientAPI.localizeText('DataReadError', [binding.OrderS])); }); clientAPI.dismissActivityIndicator(); return clientAPI.executeAction("/App/Actions/ShowSalesOrderActions/NavToShowSalesOrder.action");
The binding transfers correctly to the Next Page.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Without the full project I can't say for sure why. However, I did a test with the following setup.
Data Table -> OnPress -> Navigation Action -> Modal Page
On the Modal page I have a button and a Key Value control to confirm the default binding for the page is the selected row from the data table. In the OnPress of the button I call the first rule
Button -> OnPress -> Rule 1 -> SetActionBinding -> Rule 2 -> Navigation -> Detail Page
I checked via the debugger that in both Rule 1 and Rule 2 the ClientAPI.binding was still set to the selected Row from the Data Table. On the Detail Page there are default bindings to the data from the selected row and they are populated as expected confirming the binding was passed from the Data Table row to the detail page.
Since there is stuff in your Rule 2 I don't see I can't say if that impacts anything or not but it looks like you should be good to go assuming your detail page is trying to bind to the row properties from the Data Table.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill,
I made a mistake in the explanation.
It isn't an ObjectTable but a DataTable(the customer need a more data to show in columns).
Unfortunately the DataTable does not have actions like ObjectTable(ex.: swipe actions) than when I click on a Sales Order a new modal page appears where through buttons you can choose to Show Details, Copy, Reject sales order.
When I click Show Details button, the first rule was called, than the Fetch Rule and finally the NavToShowSalesOrder execute action.
The detail page have empty header data fields because the binding is empty.
I need to know how to transfer the binding of DataTable row press to detail page.
I tried setActionBinding just before NavToShowSalesOrder but it seems to not work.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@bill_froelichmodal page. I'm not trying to use popover menu.
User | Count |
---|---|
78 | |
29 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.