user471317
user471317

Reputation: 1231

Knockout - sorting table with a fixed row

I was able to implement sorting as explained in this article http://ryanrahlf.com/sorting-tables-by-column-header-with-knockout-js/

But I would like the last row in the observableArray to stay put. In our case, the last row is like a summary/total. Is it possible to sort an observableArray of object, but skip the last object?

Thanks.

Upvotes: 0

Views: 46

Answers (1)

Roy J
Roy J

Reputation: 43899

The way I would do it is: put sortable data in one array, the summary is another observable (maybe a computed), there's another computed that appends the summary to the sortable array. The final computed is what goes in the table, but the sorting is done on the first array.

Upvotes: 1

Related Questions