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-list-view items display as [object Object]

Majdi JaqamanSep 18 2018 — edited Sep 18 2018

Hello,

I must be doing something wrong, but I'm not sure what it is.

I have contacts.js under viewModels which has the following code:

===============================================

define(['ojs/ojcore', 'knockout', 'jquery', 'appController', 'ojs/ojmodule-element-utils'],

function(oj, ko, $, app, moduleUtils) {

function IncidentsViewModel() {

  var self = this;

  // Navigation setup

  var projectContacts = \[

  {code: 'JS', firstName: 'John', lastName: 'Smith'},

  {code: 'MT', firstName: 'Mark', lastName: 'Twain'},

  {code: 'SJ', firstName: 'Stephanie', lastName: 'Jackson'},

  {code: "AF", firstName: 'Alexander', lastName: 'Fisher'}

  \];

  self.projectContacts = new oj.ArrayTableDataSource(projectContacts, {idAttribute: 'code'});

....

==============================================

And I have contact.html under views which has the following code:

==============================================

<!--^M

Copyright (c) 2014, 2018, Oracle and/or its affiliates.^M

The Universal Permissive License (UPL), Version 1.0^M

-->

<div class="oj-hybrid-applayout-page">

<div class="oj-applayout-fixed-top">

  \<!--

   \*\* Oracle JET V5.2.0 hybrid mobile application header pattern.

   \*\* Please see the Oracle JET Cookbook App Shell: Hybrid Mobile demos for

   \*\* more information on how to use this pattern.

\-->

\<header role="banner" class="oj-hybrid-applayout-header">

  \<oj-module config="\[\[headerConfig\]\]">\</oj-module>

\</header>

</div>

<!-- This is where your main page content will be loaded -->

<div class="oj-applayout-content">

\<div role="main" class="oj-hybrid-applayout-content">

  \<div class="oj-hybrid-padding">

    \<oj-list-view id="contacts" data="\[\[projectContacts\]\]" as="contact">

            \<template>

            \<span>\<oj-bind-text value="\[\[contact.data.code\]\]">\</oj-bind-text>\</span>

            \</template>

    \</oj-list-view>

  \</div>

\</div>

</div>

</div>

==============================================

 When I deploy this to a simulator I get the results shown below. Obviously the data is there, but why isn't it displaying the value of code attribute rather than \[object Object\]?

contacts.png

Regards,

Majdi Jaqaman

Comments
Post Details
Added on Sep 18 2018
1 comment
267 views