Get current Sort Key Of Backgrid Table

97 Views Asked by At

I have following table made by Backgrid.js:

this.grid = new FixedWidthGrid({
        columns: this.columns,
        row: SelectableDocumentContextMenuRow.extend({
            contextMenu: ContextMenuHelper.onRightClick
        }),
        collection: self.collection,
        header: FilterHeader,
        contextMenu: ContextMenuHelper.onRightClick
    });

Now, when I click on a header label, the entire table gets sorted by that attribute on the client.

How can I get the current sort key/attribute (e.g. name, age etc.) of the collection?

1

There are 1 best solutions below

0
Aaron On

If you are using backbone.paginator you should be able to get this by checking the value of collection.state.sortKey