Thanks for posting your code, and your update. Preserving and restoring
the entire row order is certainly simpler and faster than what I was
suggesting.
But one potential limitation comes up if the data can be changed, including
the adding or removing of rows. I thought that was what you wanted
I had meant that there could be modifications to the order that are not the
result of sorting, but now that I think about that, they wouldn't be
reflected in the sortIndexes unless there were a subsequent sort, so you're
right, sortIndexes isn't the definitive source for row ordering. In any
Here's an improved version:
http://jsfiddle.net/p96x6pxz/2/
It maintains entire sort state (not just the last sort) and selection state
across redraws.
David
On Fri, Aug 28, 2015 at 9:20 PM, David Manz wrote:
> Daniel,
>
> Thank you for your guidance--it was very
I have a table with multiple sortable columns and dynamic data. When the
data in the table is updated, I need to redraw the table, and I would like
to maintain the sort state across the redraw. However, it appears to me
that there is no way to do this without actually modifying the order of
At this point, yes, you'll have to manage the sorting yourself, which would
probably be easiest using getSortedRows() and constructing a DataView with
those rows using setRows().
The Table chart only knows about one column for sorting so it can indicate
that column in the header; it also supports
Daniel,
Thank you for your guidance--it was very helpful.
I considered your idea of keeping the history of sorts and then replaying
them upon a redraw, but that's a bit complicated and it is conceivable that
the order of rows could change in response to events other than
sorting--the Netflix DVD