gwtproject / gwt

GWT Open Source Project
http://www.gwtproject.org
1.52k stars 374 forks source link

CheckboxCell does not firing setFieldUpdater (FieldUpdater) on Firefox (10.0.2) #7207

Open dankurka opened 9 years ago

dankurka commented 9 years ago

Originally reported on Google Code with ID 7210

CheckboxCell (in celltree) does not firing setFieldUpdater (FieldUpdater) in Firefox
(10.0.2)

Found in GWT Release (e.g. 2.4.0, 2.5.0 RC):

GWT 2.4.0

Encountered on OS / Browser (e.g. WinXP, IE8-9, FF7):

WinVista, Firefox 10.0.2. This is not an issue on Chrome

Detailed description:

I took code from this showcase:
http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTree
and I changed file ContactTreeViewModel.java

List<HasCell<ContactInfo, ?>> hasCells = new ArrayList<HasCell<ContactInfo, ?>>();
    hasCells.add(new HasCell<ContactInfo, Boolean>() {

      private CheckboxCell cell = new CheckboxCell(true, false);

      public Cell<Boolean> getCell() {
        return cell;
      }

      public FieldUpdater<ContactInfo, Boolean> getFieldUpdater() {
        return new FieldUpdater<ContactInfo, Boolean>() {
                     @Override
                    public void update(int index, ContactInfo object,
                            Boolean value) {
                        Window.alert("TEST"); // <----- firefox = nothing happens; never see alert dialog
box. chrome = it's works OK.

             }
        };
      }

      public Boolean getValue(ContactInfo object) {
        return selectionModel.isSelected(object);
      }
    });

Workaround if you have one:

similar issue with workaround
http://code.google.com/p/google-web-toolkit/issues/detail?can=1&q=FieldUpdater%20CheckboxCell&colspec=ID%20Type%20Status%20Owner%20Milestone%20Summary%20Stars&id=5256

Reported by mareka85 on 2012-02-22 23:07:32

dankurka commented 9 years ago
More simple workaround would be adding the following line to cell container init:
grid.sinkEvents(Event.ONCHANGE);

Reported by aleksei.andreev on 2012-12-15 19:26:47

dankurka commented 9 years ago
Simplest Solution is to modify the CheckBoxCell
private CheckboxCell cell = new CheckboxCell(true, true);
I spent 4 hours debugging the issue. And this is what I deciphered. It works like a
charm

Reported by mailtoharshgupta on 2013-05-13 09:09:07

dankurka commented 9 years ago
Do you mind proposing a patch, see: http://www.gwtproject.org/makinggwtbetter.html

Reported by dankurka@google.com on 2013-05-28 01:58:00

dankurka commented 9 years ago
I'm not sure about the side effect of utilizing cell = new CheckboxCell(true, true);

but It resolved my issue. 

Thanks a million

Reported by rakhshan on 2014-03-21 17:31:18