Russell, What I do is to capture the 'sort' event, and save the column and direction. Then, on a (re-)draw() call, I give it the column and direction to sort on. These are parameters in the second argument of the draw() method. Works like a charm. However, there's no way I know of to do the same for scrolling... if your user is 50 lines "down" in a 150 line table, and a draw() method is called (with or without the sorting parameters), you're going to throw the user back up to the top of the table. I wish there were a way to grab the "position" of the scrolling like the "state" of the sorting so that you can "return" gracefully to the same spot.
Bob On Feb 17, 12:20 pm, russell_h <[email protected]> wrote: > I have the same question. I have a table, for which the client will be > receiving updated data via a websocket. However I've noticed, at least > with the Table visualization, when you re-draw it it loses any sorting > that the user has applied to it. Is there a way around this? Perhaps > some way to dump and re-load the state after drawing? > > Thanks, > > Russell > > On Feb 16, 4:50 pm, Parand <[email protected]> wrote: > > > > > Hello, > > > What's the recommended method for dealing with updates to data and > > hence updates to the rendered chart? For example, if you have an org > > chart and the user adds a node, what's the best way to update the > > display (assuming no page reload)? Is the only option to re-render the > > whole chart using .draw or is there an update method? > > > Also, if there are major changes to the data (say, most of the rows > > change), is it better to do a DataTable.removeRows followed by an > > addRows, or better to throw away the old DataTable and allocate a new > > one? > > > In general, what's the strategy for handling updates without a page > > reload? > > > Best, > > > Parand -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
