I was strugling with this for a long while.
Thanks john, it worked great!
Regards
On Thursday, October 28, 2010 12:05:42 PM UTC-3, John LaBanca wrote:
>
> You can create a Column with a ButtonCell as follows:
> ButtonCell buttonCell = new ButtonCell();
> Column buttonColumn = new Column<DocumentDetailsDTO, String>(buttonCell) {
> @Override
> public String getValue(DocumentDetailsDTO object) {
> // The value to display in the button.
> return object.getName();
> }
> }
> table.addColumn(buttonColumn, "Action");
>
> You can then set a FieldUpdater on the Column to be notified of clicks.
> buttonColumn.setFieldUpdater(new FieldUpdater<DocumentDetailsDTO,
> String>() {
> public void update(int index, DocumentDetailsDTO object, String value) {
> // Value is the button value. Object is the row object.
> Window.alert("You clicked: " + value);
> }
> });
>
> Thanks,
> John LaBanca
> [email protected] <javascript:>
>
>
> On Thu, Oct 28, 2010 at 5:26 AM, dave_mcgee <[email protected]<javascript:>
> > wrote:
>
>> Hi there,
>>
>> I'm wondering if anyone could assist me with adding buttons to columns
>> within CellTables? I can do TextColumns fine but I'm experiencing
>> issues adding a button I've defined. So its been working fine with the
>> text using the code at the end.. but i want to do this:
>>
>> // create a column for a download button
>> // add the button to the column
>> // add the column to the table
>>
>>
>> Any ideas much apreciated!
>> --
>>
>> (This works fine for text..)
>>
>> documentColumn = new TextColumn<DocumentDetailsDTO>() {
>> @Override
>> public String getValue(DocumentDetailsDTO object) {
>> return object.getName();
>> }
>> };
>>
>> table.addColumn(documentColumn, "File");
>>
>> Regards,
>> Dave.
>>
>> --
>> 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]<javascript:>
>> .
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>.
>> 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 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-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.