Search code examples
polymer-2.xnuxeo

Item inside <nuxeo-data-table-column> component passed to a function as an argument yields empty object


<nuxeo-data-table-column>
  [[item.title]]
</nuxeo-data-table-column>

This works. Here 'item.title' renders title.

<nuxeo-data-table-column>
 [[_callme(item)]]
</nuxeo-data-table-column>

_callme: function (item) {
  console.log(item);
}

This doesn't work. Here 'item' is an empty object

Where my I wrong ?


Solution

  • I end up fetching page provider manually and fed to 'items' property to 'nuxeo-data-table' which then works.

    Template

    <nuxeo-page-provider id="nxProvider">
      <nuxeo-data-table items="[[data.entries]]">
        <nuxeo-data-table-column>
          [[_callme(item)]]
        </nuxeo-data-table-column>
      </nuxeo-data-table>
    </nuxeo-page-provider>
    

    Script

     setIntialValue:function(){
                this.$.nxProvider.fetch().then(data=>{
                   this.data = Object.assign({}, data);
                 })
              }
    
     _callme: function (item) { console.log(item); } ->works