Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

oj-table not rendering on UI

Manikanta_RendlaJul 24 2022

Hi all,
I am unable to display oj-table on UI in oracle JET. Please refer my code.
customer.html:
<!--
Copyright (c) 2014, 2022, Oracle and/or its affiliates.
Licensed under The Universal Permissive License (UPL), Version 1.0
as shown at https://oss.oracle.com/licenses/upl/
-->
<div class="oj-hybrid-padding">

<oj-table id="table" aria-label="Employee Table" data="[[datasource]]" columns='[{"headerText": "Employee Number", "field": "empno"},
{"headerText": "Employee Name","field": "ename"},
{"headerText": "Job","field": "job"},
{"headerText": "Manager","field": "mgr"},
{"headerText": "Hire Date","field": "hiredate"},
{"headerText": "Salary","field": "sal"},
{"headerText": "Commission","field": "comm"},
{"headerText": "Dept No","field": "deptno"}]' class="demo-table-container">
</oj-table>
</div>

customer.js:

/**
* @license
* Copyright (c) 2014, 2022, Oracle and/or its affiliates.
* Licensed under The Universal Permissive License (UPL), Version 1.0
* as shown at https://oss.oracle.com/licenses/upl/
* @ignore
*/
/*
* Your customer ViewModel code goes here
*/
define(['ojs/ojcore','jquery', 'knockout','ojs/ojtable','ojs/ojarraytabledatasource'],
function(oj,$, ko) {
function CustomerViewModel() {

var employeeArray=\[{empno:1001,ename:'Test',job:'test job',mgr:123,hiredate:'12-JAN-2003',sal:100,comm:123,deptno:10}\];  
 
    this.datasource= new ArrayTableDataSource(  
        employeeArray,  
        {idAttribute:'empno'}  
    );  

}  

 

/\*  
 \* Returns an instance of the ViewModel providing one instance of the ViewModel. If needed,  
 \* return a constructor for the ViewModel so that the ViewModel is constructed  
 \* each time the view is displayed.  
 \*/  
return CustomerViewModel;  

}
);

Here I am trying to display static array table data on UI. Output is not getting on UI.
Could any one help me with this.
Thanks in advance
Manikanta.R

Comments

Hamza Al-abbasi

Hello venapex,
I have miss understand what are you want to achieve, can you reproduce it on apex.oracle.com?

Answer

HI,
in general, it's recommended to have your Interactive Grid Query returning column names in upper case and without spaces. Each column has the Heading and Label attributes where you can specify the content to display to end users.
The reason for this not working is that Interactive Grid column values are provided by APEX session state, which is the same thing as page items. And page item names in APEX are ... case-insensitive and must not contain spaces. So it's the same restrictions which apply here.
But the solution is easy: Just change your query to return "clean" column names, and use the Label and Heading attributes to provide content to be displayed in the UI.
Bildschirmfoto 2021-10-21 um 11.11.51.pngBest regards
-Carsten

Marked as Answer by venapex · Nov 9 2021
1 - 2

Post Details

Added on Jul 24 2022
1 comment
199 views