David-Mulder / paper-datatable

A material design implementation of a data table.
GNU General Public License v3.0
237 stars 92 forks source link

Aurelia + paper-datatable #88

Open DiegoGallegos4 opened 8 years ago

DiegoGallegos4 commented 8 years ago

I have the following issue.

I am using python to generate my JSON from my database. I returns an Array of JSON objects.

[
    {
        "quantity": 1.0, 
        "category": "Electric", 
        "code": "A1", 
        "description": "1/2 pipe", 
        "id": 1, 
        "unit": "meter"
    }
]

I am using Aurelia to fetch the values. I already tried to iterate over the array and printing the values as a regular table. But when I passed the same array to paper-datatable it returns this error when I use double mustache. <paper-datatable data="{{items}}"></paper-datatable>

----> Polymer::Attributes: couldn`t decode Array as JSON ---->Uncaught TypeError: Invalid value used as weak map key

It returns this error when using Aurelia's templating ${items} notation <paper-datatable data="${items}"></paper-datatable>

--->Unhandled promise rejection TypeError: Invalid value used as weak map key(…)

This is the repo for my sample project: https://github.com/DiegoGallegos4/aurelia_polymer

The files are items.html(View) and item.js(ViewController). If you want to reproduce only add one of the above codes on the items.html file.

Thanks in advance

bobpardoe commented 8 years ago

In your vm use

import { bindable } from "aurelia-framework";

@bindable jsonData;

set this.jsonData = [{ JSON }];

in your view

<paper-datatable data.bind="jsonData"

I had the same problem.