Here is what I did for a similar problem. I added a ClickableTextCell
in the Column Header.
CellTable studentTable = new CellTable<Student>();
Column<Student, String> feesColumn = new FeesColumn();
Header<String> header = new Header<String>(new
ClickableTextCell())
{
@Override
public String getValue() {
return "MyHeader";
}
@Override
public void onBrowserEvent(Context context, Element parent,
NativeEvent event) {
PopuppanelDemo popup = new PopuppanelDemo();
int left = parent.getAbsoluteLeft();
Console.print("left"+left);
int top = parent.getAbsoluteTop();
Console.print("top"+left);
popup.setAnimationEnabled(true);
popup.setAutoHideEnabled(true);
popup.setSize("20ex", "15ex");
TextArea area = new TextArea();
area.setSize("20ex", "15ex");
area.setText("Searchterrain ,
DocAtwill,Datastoregwt,Linebalance,ecutplan");
area.setVisible(true);
popup.add(area);
popup.setPopupPosition(left+20, top+30);
popup.show();
}
};
studentTable.addColumn(feesColumn, header , new
TextHeader("footer"));
private class FeesColumn extends Column<Student, String>
{
public FeesColumn()
{
super(new EditTextCellforNumber());
}
@Override
public String getValue(Student object)
{
// TODO Auto-generated method stub
}
}
S.Abraham
www.DataStoreGwt.com
On Aug 18, 1:29 am, nacho <[email protected]> wrote:
> I need to put some kind of Button in a CellTable column.
>
> I created a class that extends AbstractCell:
>
> public class AnchorCell extends AbstractCell<Anchor> {
>
> @Override
> public void onBrowserEvent(com.google.gwt.cell.client.Cell.Context
> context,
> Element parent, Anchor value, NativeEvent event,
> ValueUpdater<Anchor> valueUpdater) {
>
> Window.alert("hello");
>
> }
>
> @Override
> public void render(com.google.gwt.cell.client.Cell.Context context,
> Anchor h, SafeHtmlBuilder sb) {
> sb.append(SafeHtmlUtils.fromTrustedString(h.toString()));
> }
>
> }
>
> And then, when I am working with my CellTable, I create a column in this
> way:
>
> Column<CompanyModel, Anchor> actionsColumn = new Column<CompanyModel,
> Anchor>(new AnchorCell()) {
>
> @Override
> public Anchor getValue(CompanyModel company) {
> Anchor h = new ActionsButton(company.getCompanyId(),
> "Acciones " + company.getCompanyId());
> return h;
> }
>
> };
>
> But I can't get the browser events.. How can I perform some action when my
> widget is clicked?
--
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.