Hi coders,
I've been working on an that uses to blobstore to save files and then serve
them to users. in a CellTable by creating it and all of its columns in the
view (Filename | DownloadButton | DateUploaded | DeleteButton) and then
dropping it into a panel after construction.
fileTable = new CellTable<SupplierFile>();
fileNames = new TextColumn<SupplierFile>() // standard text column
{
@Override
public String getValue(SupplierFile object)
{
return object.getFilename();
}
};
downloadButtons = new Column<SupplierFile, String>(/*new
ClickableTextCell()*/ new ButtonCell())
{
// the text in the cell or button
public String getValue(SupplierFile object)
{
return "Download";
}
};
downloadButtons.setFieldUpdater(new FieldUpdater<SupplierFile, String>()
{
@Override
public void update(int index, SupplierFile object, String value)
{
GWT.log("Downloading " + object.getFileUrl());
Window.open(object.getFileUrl(), "_blank", "");
}
});
DateTimeFormat dateFormat = DateTimeFormat.getFormat("dd/MM/yyyy"); //
DD/MM/YYYY
fileDates = new Column<SupplierFile, Date>(new DateCell(dateFormat))
{
@Override
public Date getValue(SupplierFile object)
{
return object.getDate();
}
};
deleteButtons = new Column<SupplierFile, String>(/*new
ClickableTextCell()*/ new ButtonCell())
{
// the text in the cell or button
public String getValue(SupplierFile object)
{
return "Delete";
}
};
deleteButtons.setFieldUpdater(new FieldUpdater<SupplierFile, String>()
{
@Override
public void update(int index, SupplierFile object, String value)
{
GWT.log("Deleting " + object.getFileUrl() + " | " + object.getId());
*// WHAT GOES HERE???*
}
});
The first 3 columns are all OK as they don't really require any logic -
only the DownloadButton really but that's just a simple Window.open();
My question is how do I call my RPC's delete() function from the view? I
should be using an event, right? All of the examples I have seen have some
kind of clickHandler() interfaces being watched by the presenter, but how
do I implement this using a CellTable?
Any help is greatly appreciated.
Thanks,
Drew
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/e6URWmrC5PgJ.
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.