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 sorting by any columns
interactively, of course.

If you want to keep the same ordering after the user does several sort
operations, then you'll want to get the 'sort' events as they occur, do the
sort yourself as you save the columns in an array that you can later use to
sort another DataTable.  One problem is deciding how many sort steps to
remember, if not all steps.  Repeatedly sorting the same column, which
reverses the previous sort, could be abbreviated to the last one.  But
sorting subsequent columns depends on the order determined by all the
previous sorts, potentially.

We could allow the sort column option (or sortColumns) to be an array, in
which case, it would sort of each of those columns in order.    And then we
could also maintain the order of the columns sorted by the user, and return
that array to you so you could apply the same ordering to another
DataTable.   This would be doing all the work that you will have to do
yourself currently, so if you end up doing that, post your code, and maybe
we will be able to use it.


On Fri, Aug 28, 2015 at 10:02 AM, David Manz <[email protected]> wrote:

> 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 the
> underlying data--mixing the model and the view.  Table and DataView both
> allow me to get the entire sort state of the table, but when I want to
> restore it, I am only allowed to specify a single column to sort by, which
> is insufficient.  DataTable allows a full specification of the sort state.
> Is that how I am supposed to maintain sort state?
>
> David
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to
> [email protected].
> Visit this group at
> http://groups.google.com/group/google-visualization-api.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-visualization-api/fc5f399b-7bb3-4203-82d9-9ef837c4cd20%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/fc5f399b-7bb3-4203-82d9-9ef837c4cd20%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>  -
978-394-1058
[email protected] <[email protected]>   5CC, Cambridge MA
[email protected] <[email protected]> 9 Juniper Ridge
Road, Acton MA

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJOAPYoFMY39UJNoS0X0nDmR89VH8in1h%2BycmvrECBKYyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to