Discussions
Categories
- 196.9K All Categories
- 2.2K Data
- 239 Big Data Appliance
- 1.9K Data Science
- 450.3K Databases
- 221.7K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 546 SQLcl
- 4K SQL Developer Data Modeler
- 187K SQL & PL/SQL
- 21.3K SQL Developer
- 295.9K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.6K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 155 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 442 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 Portuguese
Expression binding in nested oj-list-view?

I have a pair of entities with a 1:n relation. For example an OrderHeader and an OrderLine. I use a REST service to provide me data for several orders and the lines for each order.
I intend to build a list of collapsible orders, with oj-collapsible and have no problems with that. Now for each order, I am using a oj-navigation-list with a template to get data from each line and show the lines as navigable items. For the navigation list, how do I create the dataProvider?
I tried this:
<oj-navigation-list id="activitiesList" drill-mode="none" data="[[{
new ArrayDataProvider(order.data.lines, {keyAttributes:'code'});
}()]]">
<template slot="itemTemplate" data-oj-as="line">
................................................
</template>
</oj-navigation-list>
I cannot get past this because the framework cannot parse the expression inside.
What mistake am I making? Is expression binding even allowed? What is the correct method?
Please help..
Rahul
Best Answer
-
I achieved what I needed with a function in place of an inline call. I just created a method:
getOrderLineProvider(linesArrayVar : Array<OrderLines>){
//...............return new ArrayDataProvider from the linesArrayVar with appropriate keys
}
and in my nav list tag,
data=[[getOrderLineProvider(order.data.lines)]]
I guess inline syntax parser does not allow a slightly complicated IIFE
Answers
-
I achieved what I needed with a function in place of an inline call. I just created a method:
getOrderLineProvider(linesArrayVar : Array<OrderLines>){
//...............return new ArrayDataProvider from the linesArrayVar with appropriate keys
}
and in my nav list tag,
data=[[getOrderLineProvider(order.data.lines)]]
I guess inline syntax parser does not allow a slightly complicated IIFE
-
I believe you do not need to pass in the argument either. It should be available as part of one of the three arguments passed to all methods. (event, data, context)
-
Hmm.. Nope.. this is not an event. This is merely a method to procure the DataPRovider from the current Order data. Given this, is'nt the parameter still required?
If it is not, can you please provide a pointer to a similiar place in the cookbook? Or provide the syntax in one of these comments please?
-
And BTW, I cannot still succeed with the original attempt to do this inline creation of the DataProvider. Is that even possible?.
-
I would not recommend doing inline coding like that. You could easily run into Content Security Policy issues when you do this kind of thing. Use the separation of HTML/JavaScript and add the DataProvider definition in the viewModel.
I honestly don't know if it's suppose to work or not. I've never seen anyone try it before.
-
I can see your point. My initial need though is met. So no point taking this further to an accurate yes/no solution.