Hello Canvas Experts,
I’m creating a table using a Named MDX and would like to sort the table by one of the value columns returned (fixed sorting, no user interaction required), how can I do this? Is it possible using the ‘options’ section of the $tm1Ui.tableCreate function?
Thanks,
David
plim
June 13, 2019, 1:02am
2
Hi @anz.fin.all.mailbox ,
The Sortable, Filtered Table
menu of the Canvas Samples application should be able to help you out on this.
–
Paul
Hi @plim ,
I’ve looked at that sample already but struggling to see how to apply it in our example (my technical skills aren’t up to scratch).
In the table header I’m repeating data column labels as follows:
<th ng-repeat="col in row.columns" ng-if="col.visible" colspan="{{col.colspan}}" rowspan="{{col.rowspan}}" class="text-center">
{{col.key}}
</th>
Then in the table body I’m repeating the data:
<td ng-repeat="cell in row.cells" class="text-right">
{{cell.value | formatNumber:2}}
</td>
Inside this repeat is one column called “Metres” and I want to have a fixed sort on this column by ascending value. How is this possible?
Thanks,
David
plim
June 13, 2019, 3:46am
4
Hi @anz.fin.all.mailbox ,
Then you might just need to add an Angular order filter on the ng-repeat of the rows:
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
AngularJS is what HTML would have been, had it been designed for building web-apps.
Declarative templates with data-binding, MVC, dependency injection and great
testability story all implemented with pure client-side...
I am not sure of the contents of your model / variable, but it can potentially look like:
<tr ng-repeat="row in yourtabledata | orderBy:'Metres'">...</tr>
Or if it is like the 4th or 5th column in those cells:
<tr ng-repeat="row in yourtabledata | orderBy:'cells[4].value'">...</tr>
Let us know how it goes.
–
Cheers,
Paul
1 Like
Hi @plim ,
I was able to get what I needed this time around by using your second suggestion, thanks so much!
Cheers,
David