Friday, October 24, 2014

Re: FieldUpdater.update it not fired for ButtonCell in Chrome browser

Was able to figure out the problem. Here are the details:

I was displaying a list of Projects inside a LayoutPanel and on clicking a ButtonCell in the list I was hiding the list and displaying a details form present inside the same LayoutPanel. Following is the piece of problematic code:

<g:LayoutPanel height="100%" width="100%">
    ........
    <g:layer top="17%" left="0%" height="83%" width="100%">        --------> Layer 1
        <d:ProjectListForm ui:field="projectListForm" visible="true"></d:ProjectListForm>
    </g:layer>
    <g:layer top="17%" left="0%" height="83%" width="100%">        ----------> Layer 2
        <d:ProjectDetailsForm ui:field="projectDetailsForm" visible="false"></d:ProjectListForm>
    </g:layer>
</g:LayoutPanel>

Notice how I created two layers (Layer1 and Layer2) overlapping each other. Whenever the user clicked "Details" ButtonCell I was hiding ProjectListForm and showing ProjectDetailsForm. I guess the layer over the top was preventing mouse events to reach to the layer beneath it. I have now changed the code to the following:

<g:LayoutPanel height="100%" width="100%">
    ........
    <g:layer top="17%" left="0%" height="83%" width="100%">        --------> There is only one Layer now
        <g:LayoutPanel width="100%" height="100%" ui:field="displayLayer">   -------> Added a new LayoutPanel
            <g:layer height="100%" width="100%">
                <d:ProjectListForm ui:field="projectListForm" visible="true"></d:ProjectListForm>
            </g:layer>
        </g:LayoutPanel>
    </g:layer>
</g:LayoutPanel>

The ProjectDetailsForm object is not added as the part of UiBinder any more. Instead I instantiate it in the associated Java class. I clear the child elements of "displayLayer" LayoutPanel and add the ProjectDetailsForm object whenever the user clicks the "Details" ButtonCell.


On Thursday, October 23, 2014 12:02:04 AM UTC+5:30, Tomek Kańka wrote:

Hi Bharat.

It HAS TO work. I do such things every day. With ButtonCell, ClickableTextCell and some custom cells.
Check again,  there is problem somewhere else, some NPE or sthg.



W dniu wtorek, 21 października 2014 14:28:21 UTC+2 użytkownik Bharat Parikh napisał:
GWT Version: GWT 2.6.0
Browser for which the code is not working: Google Chrome Version 38.0.2125.104 m
Browser for which the code is working: IE 9

I have a ButtonCell added as a column in DataGrid. The FieldUpdater.update event for the ButtonCell is not fired in Chrome. The same works fine in IE 9. On further observation I found that after hovering the mouse over the rows of DataGrid nothing happens in Chrome. But on mouse-over in IE the rows change color (as expected). Thus, seems like the DataGrid is not receiving any mouse events in Chrome and hence the ButtonCell is not working.

I have following hierarchy of elements:
RootLayoutPanel -> DockLayoutPanel-> SimpleLayoutPanel -> LayoutPanel -> DockLayoutPanel -> DataGrid -> ButtonCell (a column inside DataGrid)

Here is how I add the ButtonCell:

Column<MyProject,String> detailsColumn =
new Column<MyProject,String>(new ButtonCell()) {
 public String getValue(MyProject object) {
   return "DETAILS";
 }
};
detailsColumn.setFieldUpdater(new FieldUpdater<MyProject, String>() {
 @Override
 public void update(int index, MyProject project, String value) {
 Window.alert("Button Clicked"); //nothing happens here; the dialog is not displayed
 }
});
dataGrid.addColumn(detailsColumn, "DETAILS");
dataGrid.setColumnWidth(detailsColumn, 10, Unit.PCT);


I tried replacing the DataGrid with CellTable with no success. Replacing ButtonCell with ActionCell also didn't work. Note that the DataGrid example from GWT Showcase works fine on the Chrome browser.

I am suspecting this issue is similar to: https://code.google.com/p/google-web-toolkit/issues/detail?id=7139 but have no idea how to resolve it.

Anyone else facing this issue? Any help would be highly appreciated.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment