This is slightly tricky with the current syntax. I've occasionally wondered if there's a case for having something like `{{#each sort(rows) as row}}` or `{{#each row in sort(rows)}}` (probably the first as the second is a valid JavaScript expression).
But it's totally possible. The bad way would be this: using the `iRow` index reference you can get the current row with `sort(rows)[iRow]`:
{{#columns}}
<td>
{{#if sort(rows)[fieldName]}}
{{sort(rows)[fieldName]}}
{{/if}}
</td>
{{/columns}}
That's far from ideal, because you have to keep re-sorting `rows`. But you can store the result of sorting `rows` as a computed property:
computed: {
sortedRows: function () {
// we slice the data so we don't mutate the original array
return this.get( 'rows' ).slice().sort( byPriority );
}
}
Then, you can use that property as many times as you like in your template without penalty:
{{#columns}}
<td>
{{#if sortedRows[fieldName]}}
{{sortedRows[fieldName]}}
{{/if}}
</td>
{{/columns}}