Search code examples
javascripthtmloracle-jet

Oracle JET - my oj-list-view isn't working


I have a basic oj-list-view element with some static data. As far as I can see I have implemented it correctly, made sure to include all the relevant variables in the dataSource. Yet the element shows the loading symbol and the console simply shows an error for the oj.Collection. Where is my mistake?

HTML

<oj-list-view id="listview" aria-label="list using json data" 
           data="[[dataSource]]" selection-mode="single" drill-mode="none">
    <template slot="itemTemplate">
            <div>
              <span data-bind="text: text1"></span>
              <span data-bind="text: text2"></span>
            </div>
    </template>       
</oj-list-view>

JS

var data = [{"text1": "cat", "text2":"meow"},
            {"text1":"dog", "text2":"woof"}];
    self.dataProvider = new oj.ArrayDataProvider(data, null ); 

Solution

  • template tag was introduced only in Oracle Jet version 4.1. You can try either changing your project version to 4.1 or using the the script tag for the list template.

    Here is the link for List Template- Click me :)