Unfortunately not at the moment.  CellTable uses a FieldUpdater, which has
the row index and row object.  We can add the same to CellList.  Can you
create an issue to track this?

Thanks,
John LaBanca
jlaba...@google.com


On Mon, Dec 20, 2010 at 5:39 AM, -sowdri- <sow...@gmail.com> wrote:

> The below code is taken from *Data Presentation Widget documentation (*
> http://code.google.com/webtoolkit/doc/latest/DevGuideUiCellWidgets.html#updating-database
> )
>
> public class CellListValueUpdaterExample implements EntryPoint {
>
>  /**
>  * The list of data to display.
>  */
> private static final List<String> DAYS = Arrays.asList("Sunday", "Monday",
>  "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
>
> public void onModuleLoad() {
> // Create a cell that will interact with a value updater.
>  EditTextCell inputCell = new EditTextCell();
>
>  // Create a CellList that uses the cell.
> CellList<String> cellList = new CellList<String>(inputCell);
>
> // Create a value updater that will be called when the value in a cell
>  // changes.
> ValueUpdater<String> valueUpdater = new ValueUpdater<String>() {
>  public void update(String newValue) {
> Window.alert("You typed: " + newValue);
>  }
> };
>  // Add the value updater to the cellList.
>  cellList.setValueUpdater(valueUpdater);
>  // Set the total row count. This isn't strictly necessary, but it
> // affects
>  // paging calculations, so its good habit to keep the row count up to
> // date.
>  cellList.setRowCount(DAYS.size(), true);
>
>  // Push the data into the widget.
> cellList.setRowData(0, DAYS);
>
> // Add it to the root panel.
> RootPanel.get().add(cellList);
>  }
> }
>
> When a cell is edited, the window alerts the new value.
>
> *Is it possible to get the index of the modified value, such that I could
> update the value in the original list?*
> *
> *
> Something like:
>
> ValueUpdater<List<String>, String> valueUpdater = new
> ValueUpdater<List<String>, String>() {
>
> @Override
> public void update(int index, List<String> object, String value) {
>                               object.set(index, value);
> }
>  };
>
>
> Thanks in advance!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to