2
votes

I am using a gwt cell table to display the search results..I have two columns where I display text related to the search and I have a column with an arrow image and when i click on it I should be able to open a dialog box and place it right beside the image clicked. On the column click I am able to show a dialog box but I am not able to find a way to determine the exact position of the image clicked so that I can place right next to it.. The functionality expected is somewhat similar to what happens when we mouse over on the arrow on the google search page.... Please help....

1
Have a look at the implementation of the DateBoxCell, which is similar (place the popup calendar right next to the date clicked) - Thomas Broyer
GWT does not have DateBoxCell..They might have replaced it with DatePickerCell and I have seen the implementation of it and they used absolute left and absolute to as follows: panel.setPopupPosition(lastParent.getAbsoluteLeft() + offsetX, lastParent.getAbsoluteTop() + offsetY); My question is how do I find out the absolute left and absolute top of the image which is present in a column clicked ... - Saritha
Sorry, my bad, meant DatePickerCell, not DateBoxCell. And to answer your question, well, how does DatePickerCell finds out the absolute left and absolute top? Can't you do the same? - Thomas Broyer

1 Answers

4
votes

You just need to do this. But, it only for textCell. I think you know how to use this sample for your case.

column.setFieldUpdater(new FieldUpdater<Type, String>() {                   
                @Override
                public void update(int index, Type object, String value) {
                    int x = cellTable.getRowElement(index).getCells().getItem(columnNumber).getAbsoluteLeft();
                    int y = cellTable.getRowElement(index).getCells().getItem(columnNumber).getAbsoluteTop();
                    popupPanel.setPopupPosition(x, y);
                    popupPanel.show();
                }
            });