This illustrates the general idea:-
public class ProxyCell extends AbstractCell<String> {
private AbstractCell<String> cellReadOnly = new TextCell();
private AbstractCell<String> cellEdit = new EditTextCell();
private Object keyEditRow;
private AbstractCell<String> getCell(Object key) {
if(key==keyEditRow) {
return cellEdit;
}
return cellReadOnly;
}
@Override
public void render(String value, Object key, SafeHtmlBuilder sb) {
getCell(key).render(value, key, sb);
}
@Override
public void onBrowserEvent(Element parent, String value, Object
key,
NativeEvent event, ValueUpdater<String> valueUpdater) {
super.onBrowserEvent(parent, value, key, event, valueUpdater);
getCell(key).onBrowserEvent(parent, value, key, event, valueUpdater);
}
@Override
//... Other methods excluded for brevity
}
On Dec 17, 2:45 pm, Opal <[email protected]> wrote:
> Hi,
>
> Thank You very much for the response. Do You have any sample code that
> You can share?
>
> On 17 Gru, 15:16, manstis <[email protected]> wrote:
>
> > I implemented something similar in the past (to have different cells
> > on different rows).
>
> > I wrote a Cell proxy class used by the Column that delegated to a
> > number of different Cell implementations depending upon the key
> > provided by the KeyProvider.
>
> > On Dec 16, 3:48 pm, Opal <[email protected]> wrote:
>
> > > Hi,
>
> > > I use CellTable to display the data in my web app and would like to
> > > add an empty row at the end to enable users to add new data. In all
> > > rows (including last one) I use EditTextCell to update data, but I
> > > would like to display TextInputCell in the last row only. Does anybody
> > > know how it can be done? E.g. the last record's value of id field is
> > > -1. Depending on this knowledge I can recognize when TextInpuCell
> > > should be displayed but don't know how to implement it. Any ideas?
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" 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-web-toolkit?hl=en.