Hello everyone!
I'm attempting to prototype something with UI5 (HANA DB as database) and am running into roadblocks. I think that there are a few pieces of the puzzle which I have not completely glued together. I could really use some advice! Here is my scenario:
-There are two database tables defined in HANA
-Table 1 contains a small list of items with two fields defined (primary key, name)
-Table 2 contains a slightly larger set of items which is dependent on the first table via an association (primary key, name, association to Table 1)
-Both tables have views which are defined using the HDBDD format
-Both views have been exposed via the xsodata file which I can format into JSON using the HTTP URL + $format=json
I am attempting to leverage a UI5 popover to serve as a navigation menu. I would like to have the first view create the list of items displayed within the first page of the popover. Based on the selection of the item in the first page, the results displayed on the second page should be filtered (by means of the association).
I have been able to create a simple popover with two pages. Each page has a corresponding StandardItemList which is bound directly via the XML fragment (there is an XML view associated with the JavaScript controller, but the popover is defined within an XML fragment). As it stands, the results of each view/table are being displayed correctly in the popover navigation.
However, I am struggling to figure out the best approach to filtering the results of the second page based on the selection of the first page. I have a couple of questions:
1. Does anyone know if this is possible? I have seen sample code and documentation on how to filter tables (and other data types), but have not yet seen an example of someone using a popover + StandardItemList (without defining a table in JavaScript). I am not opposed to using a table, but I am not clear on how this will integrate with the popover, or how to modify the look & feel for the end user such that the popover "design" is not effected.
2. What would be the recommended approach? Here is what I've tried so far (embarrassingly quite a bit, yet still struggling):
-Get selected item from first Page/StandardItemList via event.getSource().getInfo() --> storing primary key on info field of first page.
//Getting the selected item works okay, and I can display the selected item via a MessageToast
-Attempted to bind the selected item from the first Page/StandardItemList to the second Page/List using databinding
//This has not been successful, but my assumption is that this is a result of the item list being an array
//I attempted to create an array out of the selected item to bind it to every item on the second page, but that has proven unsuccessful
//Could be failing as a result of poor programming or misunderstanding syntax, among other possibilities
-Attempted to filter the items using complex expression binding in the XML fragment (via "visible" field in item list)
//I am able to perform a complex expression binding which compares the foreign key of the second table to a constant value
//Example: visible="{= ${ObjectsList>ActionID} === 1 }"
//However, I am not able to call the selected item using complex expression binding - have tried making it an array and global variable
-Attempted to bind a list filter from the controller, using the selected item from event.getSource().getInfo()
//This was a mess, as I was not able to completely comprehend the architecture and syntax of "fliters"
//Does a filter require a table to be created within the JavaScript controller?
I think that's the most of it - any advice would be extremely appreciated! Mainly, I would like to gain a deeper understanding of how the components should be integrate such that the architecture is designed correctly and will not create a mess down the road.