Last week I had to develop a simple Eventcalendar. I used datatable on a page fragment for displaying events in weekly/monthly views. I store event objects in a simple LinkedList behind the datatable. We have a different page fragment where you can add new events or delete old ones and after performing the action I wanted to go back to the original calendar and show the changes with the refreshed values. Unfortunately I realized the datatable didn't correctly refresh. I thought the datatable should refresh correctly with Icefaces Ajax capabilites but it didn't. So I started to find a workaround....
Fortunately I found a solution quickly and I would like to share with you here.

Environment: Icefaces 1.8, NetBeans 6.5, Glassfish 2.1

And here comes the workaround:

1. Create component property in the backing bean (EventCalendar.java):
private UIData tableBinding;
public UIData getTableBinding() {
return tableBinding;
}

public void setTableBinding(UIData tableBinding) {
this.tableBinding = tableBinding;
}


private LinkedList evenList;
public LinkedList getEventList() {
return eventList;
}

public void setEventList(LinkedList eventList) {
this.eventList = eventList;
}

2. Force refresh in the action method by clearing the children of component(EventCalendar.java):

public void clearElements(){
tableBinding.getChildren().clear();
}

3. Bind the parent data table in EventCalendar.jspx:

< ice:datatable id="parentTable" binding = "#{eventCalendar.tableBinding}" value = "#{eventCalendar.eventList}">




It's so simple :)

More...