after some more reading, it seems this is not part of the Vis. API yet. Here is a solution: - Dataview in GWT is protected and won't provide the add/remove functionalities like Vis. javascript. (as was recommended in one posting). - Pass the DataTable, and the Vis. Widget to the SelectHandler and redraw the widget with new/updated DataTable each time within OnSelect () method. Any other solution? Thanks.
On Dec 26, 12:05 am, Budband <[email protected]> wrote: > How can I dynamically add/remove a column to an already loaded > datatable? I am trying to build a Cancel/Delete option for every > items shown in the LineChart. > In other word, in the LineChart Category, if you click on each > category, the line item will blink in the chart. I want to be able to > delete that line item instead. > I tried to register a SelectHandler which is able to update/remove > column from the datatable, however the change won't be reflected in > the chart (Guess re-rendering is needed ?!). > > I added the following to the SelectionDemo with no success. Is there > any way to fire an event on the client side to re-render the Viz? > > SelectionDemo(Selectable viz, Label label, DataTable data) { > this.viz = viz; > this.label = label; > this.data = data; <<<<================ > } > > @Override > public void onSelect(SelectEvent event) { > StringBuffer b = new StringBuffer(); > JsArray<Selection> s = getSelections(); > for (int i = 0; i < s.length(); ++i) { > if (s.get(i).isCell()) { > b.append(" cell "); > b.append(s.get(i).getRow()); > b.append(":"); > b.append(s.get(i).getColumn()); > // remove the row > > } else if (s.get(i).isRow()) { > b.append(" row "); > b.append(s.get(i).getRow()); > } else { > b.append(" column "); > b.append(s.get(i).getColumn()); > data.removeColumn(s.get(i).getColumn()); > <<<<<<====================== > } > } > label.setText("selection changed " + b.toString()); > } -- 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.
