mercredi 3 mai 2017

Working with templates in ember-models-table

I am using ember-models-table (http://ift.tt/1NJLaZr) and I want to customize the output of a table cell. As the documentation suggests I tried with assigning a template and a component in the columns definition.

For simple use it works pretty fine but I want to use the template / component in several tables with different entities (i. e. to display enum values where I have only an id). So first thing I need is access to the value that is assigned to the column like this:

{
    "propertyName": "id",
    "title": "ID",
},
{
    "propertyName": "name",
    "title": "Name",
}

I know I can access the record property within the template / component but then I had to hardcode the property to display within the template / component () which makes it not suitable for general use.

Another question would be how to provide arbitrary data to a template / component when using with ember-models-table. Maybe this is possible with the data attribute that is defined for the column's component (see the docs: http://ift.tt/2pHl0jz) but I could not figure out how to use this data attribute. Any help is very welcome.




Aucun commentaire:

Enregistrer un commentaire