Let's follow up this discussion at the Neptune Community

(this forum will be kept in read-only mode)
Solved

Bind two model source to same UI elements

Hi all

I am new in Neptune Software and I hope I am writing in right place. I tried to search with no luck in forum.. I am studying the NAD and after I've replicated the sales order APP seen in webinar, I am trying to enhance it with "random" ideas.

Problem: I have put a checkbox in starting screen. This flag is for "show/hide" code number (for material, partner, ecc). The idea was to use the status of the flag to show/hide columns in all APP pages. I can correctly read status checkbox from start screen.

The problem is that when I bind an UI element (a form) to a class attribute (for example a structure with customer info), I cannot bind another structure (in my case the one used for binding additional properties ). I tried switching from one attribute to the other (in the binding) and the UI element properties sees only the one binded. On the properties (I tried for text properties) there is the button "Bind and concatenate" that works for UI properties but that doesn't work with model source.


What am I missing?


Thanks and regards

Gabriele


Hi Gabriele,


Welcome to planet Neptune! it is great that have you with us playing with NAD.  


You are right.  The easiest solution to your problem would be binding the "show/hide" flag (I guess it is part of a structure) to any other component in your App (for example a page or a panel) and setting the visibility of your column manually in one line of code.


My WA_VISIBLE defined as a public attribute of the ABAP class:


In my SYNC method, I will set WA_VISIBLE-SHOW_COLUMN to 'false':


Let's check the App now...    I will bind WA_VISIBLE to a Panel


  (in this example, my flag is in WA_VISIBLE-SHOW_COLUMN)


When your app retrieves the information (via AJAX), ensure that the flag is also received:


 (in this example, in the SYNC ajax call, I receive the data for WA_VISIBLE)


After the SYNC ajax call, if I check modelpanDetailItems, it should have data.


Finally, on the ajaxSuccess  event of the SYNC ajax call, set the visibility of the columns you want to show/hide:


Hope you find this example useful, kind regards,

Julian





First of all thank for your quick reply. I'm going to study the answer.. As you correctly understand I am playing to learn how the framework works and here it is my secondary doubt: I don't want to waste your time, but can you please help me in understand better the "Additional model send/receive button" you mentioned. In documentation is written: The direction of sending and receiving is interpreted from the UI control’s point of view. So as I understand, the UI element send/receive to/from the attribute binding in the list. Is this correct? 

the example I am working is always the same (salesOrder APP of Webinar), but I tried to change the logic of Ajax call to fill attribute bound to customer table (that is a node of second page (pageList): 

  • On press button of first page i call the GetOnline for the second page; here AjaxID will call method that will fill attribute IT_CUSTOMER.
  • Here is how I coded AjaxSuccess event of pageList (the second page)

  

getOnlinetabCustomer();
sap.ui.core.BusyIndicator.hide();
oApp.to("pageList");


As said, here tabCustomer is a subnode of page two (pageList) ... I don't know if is it normal/correct to have a chains of getOnline as here (on the Ajax success of getOnlinepageList I call getOnlinetabCustomer ) but it works. Well in all this, this is the minimum configuration I have to set for have all working


It's ok that pageList receive table IT_CUSTOMER by application class, but I cannot understand why I need to put the Send check on tabCustomer node...

Is something wrong in what I understood?


Thanks and regards

Gabriele

You are welcome Gabriele.


In the "Additional model Send/Receive screen"  you select what models you want to send / receive from the UI to the backend abap class.


I tried to follow your logic:

1 - on the button.press() of your pageStart you trigger  getOnlinepageList();   In this step  GET_CUSTOMER_LIST will be executed, sending  GV_PAGE_SEARCH and receiving IT_CUSTOMER.

This means the UI sends GV_PAGE_SEARCH to the ABAP class.    After execution of GET_CUSTOMER_LIST, the ABAP sends  IT_CUSTOMER  to the UI.


2 - IT_CUSTOMER is binded to  tabCustomer    so  after step1   your  Table  tabCustomer should get populated.


In the ajaxSuccess of pageList:

  • you should not need to perform a   getOnlinetabCustomer();   because it has already been populated in step 1   (getOnlinePageList() ).
  • you should just navigate to pageList   (without using the quotes in the statement, like this:   oApp.to(pageList);
  • hide the busy indicator (perfect).

So with only one ajax call, your IT_CUSTOMER  /  tabCustomer  should get populated.  You can remove AJAX ID  "DUMMY"   from   tabCustomer.

Hope I have been clear enough.. I know it might be confusing.

Kind regards,
Julian




Your explanations and hints are all really clear. I tried and it works fine and (especially) it makes sense to me.


Thank you again. 


Best regards

Gabriele

Fantastic !   You are welcome.   Any other question, please feel free to post it. ;)

Login or Signup to post a comment