Adding a context menu to DataGrid

313 views
Skip to first unread message

Karan Nih

unread,
Oct 3, 2011, 1:26:56 AM10/3/11
to Google Web Toolkit
Can some one please tell me how to add a context menu to a DataGrid in
GWT
I am using GWT 2.4

Thanks

Sudhakar Abraham

unread,
Oct 3, 2011, 11:28:21 AM10/3/11
to Google Web Toolkit
Subclass the TextInputCell, override the getConsumedEvents(),
onBrowserEvent() method. To edit the property in
Collections.singleton("contextmenu") in getConsumedEvents method. Add
this as Column.

//.java

class TestTextInputCell extends TextInputCell
{
public TestTextInputCell()
{
super();
}

@Override
public Set getConsumedEvents()
{
return Collections.singleton("contextmenu");
}

public void onBrowserEvent(Cell.Context context, Element parent,
Object value, NativeEvent event)
{
event.preventDefault();
event.stopPropagation();
}
}



S. Abraham
www.DataStoreGwt.com
Persist objects directly in GAE

Олег Рачаев

unread,
Mar 14, 2018, 1:43:46 AM3/14/18
to GWT Users
https://confluence.clazzes.org/pages/viewpage.action?pageId=425996

понедельник, 3 октября 2011 г., 9:26:56 UTC+4 пользователь Karan Nih написал:
Reply all
Reply to author
Forward
0 new messages