Open PopupDialog relative to cell in DataGrid header on click

48 views
Skip to first unread message

linus...@gmail.com

unread,
Feb 9, 2021, 1:41:15 PM2/9/21
to GWT Users
tldr;   I am trying to open a popup dialog relative to a cell in a CompositeCell column header in a DataGrid. I think I am close, but it's not quite right.  The Popup opens in the upper-left corner of the window.

Details:
I have a ClickableTextCell and can either catch the click event by overridding the onBrowserEvent or simply using the default behavior which is to call the FieldUpdater.update() method. So far so good.

But the Popup.showRelativeTo() method takes a UIObject, which the Cell is not.  I discovered the CellWidget wrapper, so when creating the column header, I wrap the ClickableTextCell with a CellWidget.  Using the FieldUpdater.update() method, I can then open the popup using showRelativeTo(theCellWidget).  But the popup opens in the upper-left corner of the browser window.  On inspection, theCellWidget absoluteLeft and Top are 0,0.

I am wondering if this is because when the CellWidget is created, the Cell is not yet visible. 

Is it possible, and if so, how can I open a popup relative to a ClickableTextCell in a DataGrid?

Thanks in advance for any insight,
Linus

The following links provided guidance, but are not directly related to the question at hand.
https://groups.google.com/g/google-web-toolkit/c/cobba9KOwmk/m/PG5wD-bc9uIJ

linus...@gmail.com

unread,
Mar 26, 2021, 8:21:00 PM3/26/21
to GWT Users
FWIW, I figured this out.

The trick was the hack that allows you to get the DataGrid ScrollPanel so you can get the horizontal scroll to correct for the calculated offsetLeft of the widget.

Reply all
Reply to author
Forward
0 new messages