GWT CellTable CheckboxCell Not working in IE8

自作多情 提交于 2019-11-26 18:38:46

问题


I am having a CellTable with CheckboxCell in it.

I have added the following handler to it:

private static Column<AIDataRecord, Boolean> m_checkColumn = 
    new Column<AIDataRecord, Boolean>(new CheckboxCell(true, false)) 
    {
        @Override
        public Boolean getValue(AIDataRecord object) 
        {
            // Get the value from the selection model.
            return object.isSelected();
        }   
        @Override
        public void onBrowserEvent(Context context, Element elem, AIDataRecord object, NativeEvent event) 
        {
            System.out.println("Browser Event Called");
            super.onBrowserEvent(context, elem, object, event); 
            String eventType = event.getType();
            if ("change".equals(eventType)) 
            {
                System.out.println("Value changed");
                object.toggleSelection();
                System.out.println("Nw : "+object.isSelected());
            }
        }
    };

where object.toggleSelection() is a method which reverses a boolean field i.e. true to false and false to true.

I am using this code find if any check box is selected or not to identify any row.

This thing is working perfectly fine in All major browsers Except IE 8.

In IE 8 I get the object.isSelected() true but still when I click on button on that panel to delete row, it shows isSelected() false for the same row.

Can any body please help me with where should I try to find the problem ? Why IE is behaving differently??

Can any Java/GWT expert please help me out...

Thanks.


回答1:


Why don't you assign a FieldUpdater to your your column? It is much simpler. For example:

m_checkColumn.setFieldUpdater(

    new FieldUpdater<AIDataRecord, Boolean>() {
         @Override
         public void update(int index, AIDataRecord object, Boolean value) {
            object.toggleSelection();
            Window.alert("Nw : " + object.isSelected());
         }
    }

);


来源:https://stackoverflow.com/questions/11666240/gwt-celltable-checkboxcell-not-working-in-ie8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!