PDA

View Full Version : Firing Onclick Event Doesnt call Eventhandler



sajjan.sarkar
1 Sep 2011, 11:31 AM
Hi,

I have a table in which one column has only checkboxes. I use a gridcellrenderer to render the checkbox and assign click event handlers.As I render every checkbox I also add it to a global List<CheckBox>.

Now outside the grid I have a radiobutton which should, when clicked, go through all the checkboxes in this list and fire a click event on each one.My problem is, that the event handlers dont seem to get called at all when I fire the event programmatically. (They do fire if I click the checkboxes)

Can someone point me where I'm going wrong?
Code:



{
// The global list:
private final List<CheckBox> listOfCheckBoxes = new ArrayList<CheckBox>();
:
:
// code to render checkbox, assign handlers and add to list
//
myColumn.setRenderer(new GridCellRenderer<ModelData>() {
@SuppressWarnings("deprecation")
@Override
public Object render(ModelData model, String property,
ColumnData config, final int rowIndex, final int colIndex,
final ListStore<ModelData> store, final Grid<ModelData> grid) {
:
:
final CheckBox cb= new CheckBox();
cb.addListener(Events.OnClick, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
// do something
});
:
:
// this grid is added to a contentpanel, this content panel also has a radio button
selectAllRadio = new Radio();
selectAllRadio.addListener(Events.OnClick, new Listener<BaseEvent>() {


@Override
public void handleEvent(BaseEvent be) {
for (StatusCheckBox scb : listOfBoxes) {
scb.fireEvent(Events.OnClick);


}

}
});



}

sajjan.sarkar
1 Sep 2011, 11:47 AM
[IGNORE] Silly mistake on my part nothing to do with the problem. Please delete this thread, I apologize.