https://opensource.addepar.com/ember-table/latest/docs/quickstart
I have follwed the above documentatiom but not able to create table. shows error in column definitions. Can anyone show me a complete example of creating basic table.
Can someone please give me a example of columns and rows constrcton details.!! I follows the docs but not wotking for me!
I can help a bit, but you havenât provided much to respond to. âshows error in column definitionsâ can cover a lot of territory. The quickstart is accurate but limited. The other examples flesh things out a bit more. They show the creation of the data structures for columns and rows. I can attest that these things work, as we used them as a basis for our own implementation. As long as the row property names are specified as the values of the column valuePath properties, everything should fundamentally hold together. Beyond that, it will mostly ignore things it doesnât understand, rather than fail.
Perhaps you can share a simplified reduction of the column and row structures you are trying to use and how youâre using it in your table template and we can spot where things are going off the rails. This will also help us to discover how to make the documentation clearer.
Looks like your template names are not the same, one is capital T the other is lower case, so your ember table @colums has no access to your Columns component in your template.js file.
I am trying to use ember-table, however I am stumbling with probably a basic ember concept. The ember-table examples show âhard codedâ values in the component.js file for the example.
For most components, I pass the model (or a subset) to the template from the route, then in the template:
{{#each model as |t|}} ....
How would the code in the component.js file look if the lastName and firstName property were being passed from the route?? model.firstName??
Thanks for the help; apologies for the basic question.
It helps to know something of your structure. Can I presume that the model contains an array of the records that you want to display in the table? If so, in the simplest case, you end up with something like:
<EmberTable as |t|>;
<t.head @columns={{columns}} />
<t.body @rows={{model}}/>
</EmberTable>
The table maps the valuePath for each field to the corresponding property of each item in the array. The other properties tell it how to handle the header and display the cells for that column. You wonât need your own {{each}} loop at all.
If you need to do something special for how your rows are displayed, you still donât need to loop, but you can access the shape of the rows and cells, as per the documentation, using something like:
<t.body as |b|>
<b.row as |r|>
<r.cell ... />
<b.row>
</t.body>