cancel
Showing results for 
Search instead for 
Did you mean: 

Expression Binding with Variable/Parameter When Working With Nested JSON Model

huibin_lau
Participant
0 Kudos

Hello People,

I have a nested JSON model as below and I have master detail pages in one view. What I want to achieve is when an order is selected in the master page, the index of the selected order is kept in a variable/parameter which is ok. Next I need to bind the order name of the selected order to a field in the detail page, the path should look like: /orders/<index>/orderName. I know that this can be achieved by routing but I would like to know the best practice when handling multiple pages in a same view and you need to have multiple binding paths with indexes to retrieve data in a nested JSON model.

{
	"orders": [
		{
			"orderId": 0,
			"orderName": "Order 1",
			"products": [
				{
					"productId": 0,
					"productName": "Product 1-A"
				},
				{
					"productId": 1,
					"productName": "Product 1-B"
				},
				{
					"productId": 2,
					"productName": "Product 1-C"
				},
				{
					"productId": 3,
					"productName": "Product 1-D"
				},
				{
					"productId": 4,
					"productName": "Product 1-F"
				}
			]
		},
		{
			"orderId": 1,
			"orderName": "Order 2",
			"products": [
				{
					"productId": 0,
					"productName": "Product 1-A"
				},
				{
					"productId": 1,
					"productName": "Product 1-B"
				},
				{
					"productId": 2,
					"productName": "Product 1-C"
				},
				{
					"productId": 3,
					"productName": "Product 1-D"
				},
				{
					"productId": 4,
					"productName": "Product 1-F"
				}
			]
		}
	]
}

Code snippet in Detail page
<f:SimpleForm title="Details">
  <f:content>
    <Label text="Order Name"/>
    <Text text="{orderModel>/orders/0/orderName}"/>
  </f:content>
</f:SimpleForm>
Best Regards,Hui Bin

Accepted Solutions (0)

Answers (0)