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!

uncaught (in promise) ReferenceError: Unable to process binding "_ojBindForEach_:

NARESH DASARIAug 17 2020 — edited Aug 18 2020

Hi,

I am getting below error when I use oj-bind-for-each

Uncaught (in promise) ReferenceError: Unable to process binding "_ojBindForEach_: function(){return {data:categories} }"

Message: categories is not defined

sample JSON

[

      {

        "ItemNumber": "Abc",

        "OrganizationCode": "MST",

        "Region": "region1",

        "DisplayName": "Test1",

        "PDHValue": "Test1 Desc1",

        "EBSValue": "Test1 Desc1"

      },

      {

        "ItemNumber": "Abc",

        "OrganizationCode": "MST",

        "Region": "region1",

        "DisplayName": "Test2",

        "PDHValue": "Test2 desc1",

        "EBSValue": "Test2 desc2"

      }

]

Demo.js file
----------------
function SimpleModel()

  {

    this.categories = ko.observable();

    this.categories = new ArrayTreeDataProvider(JSON.parse(productInfo), {keyAttributes: "ItemNumber"});       

  };

  $(

    function ()

    {

      ko.applyBindings(new SimpleModel(),

      document.getElementById('form-container'));

     }

  );

});

Demo.html code

<div id="form-container">

  <h4>Fruits and Vegetables</h4>

  <ul>

  <oj-bind-for-each data='[[categories]]'>

    <template data-oj-as="category">

      <li>

        <ul>

          <oj-bind-for-each data="[[categories.getChildDataProvider(category.data.ItemNumber)]]">

            <template data-oj-as="item">

            <li>

              <oj-bind-text value="[[category.data.ItemNumber + ' : ' + item.data.ItemNumber]]"></oj-bind-text>

            </li>

            </template>

          </oj-bind-for-each>

        </ul>

      </li>

    </template>

  </oj-bind-for-each>

  </ul>

</div>

Comments
Post Details
Added on Aug 17 2020
1 comment
910 views