tochoromero / aurelia-table

Simple functional data table for Aurelia
https://tochoromero.github.com/aurelia-table
MIT License
67 stars 25 forks source link

Can't apply sorting to dynamic columns #21

Closed esnyder232 closed 7 years ago

esnyder232 commented 7 years ago

Hey,

We're trying to make a table with dynamic headers. The documentation states to sort by using "key: [column-name]". If a key is "a string with the name of the column it will sort by" then by using the Aurelia convention you should be able to apply string interpolation like so:

<th repeat.for="col of headers" aut-sort="key: ${col}">

This resulted in an error message saying that key was null. Is there something we're doing wrong or do you think this is something that will be supported in the future?

Thanks, Eric

tochoromero commented 7 years ago

Hello Eric.

This is a use case I have not considered before. I will see what can be done about it.

tochoromero commented 7 years ago

You were very close in your syntax. I just did some testing and this will work: <th repeat.for="col of headers" aut-sort="key.bind:col">

Cheers

esnyder232 commented 7 years ago

Yeah that worked! Thanks alot man!

tochoromero commented 7 years ago

You are welcome :)