-
1. Re: ExtendedDataTable rerender and action ordering
ilya_shaikovsky May 27, 2009 10:03 AM (in response to jaand96)reRender could not happens before the action :) because action called on 5-th phase and rendering on 6-th.
show the code please. -
2. Re: ExtendedDataTable rerender and action ordering
jaand96 May 28, 2009 2:25 AM (in response to jaand96)Hi, no, you're right. Something else is wrong but that is what it looks like. First insert shows when the second is done etc... very odd!
This is the table (well the important part).
The value (ProductionPointController.productionPoint.stopTimes) is a List.<rich:extendedDataTable id="functionTable" value="#{ProductionPointController.productionPoint.stopTimes}" var="stopTime" height="200px" width="600px" selection="#{ProductionPointController.stopTimeTable.selection}" binding="#{ProductionPointController.stopTimeTable.table}" selectionMode="single"> <rich:column sortable="true" sortBy="#{stopTime.function.name}"> <f:facet name="header">Function</f:facet> <h:outputText value="#{stopTime.function.name}" /> </rich:column> ... etc ... </rich:extendedDataTable>
This is the button in the modalPanel that rerenders and fires action,<a4j:commandButton value="Save" reRender="functionTable" action="#{ProductionPointController.updateStopTime}" oncomplete="#{facesContext.maximumSeverity == null ? 'Richfaces.hideModalPanel(\'panelid\');' : ''}" />
The action inserts the new stoptime, and then updates all data from database:public void updateStopTime(){ productionPointFacade.mergeStopTime(stopTime); productionPoint = productionPointFacade.getById(productionPoint.getId()); }
The table's binding and selection is done to this class:@SuppressWarnings("unchecked") @Name(value="TableController") @Scope(ScopeType.EVENT) public class TableController<T> { //Extended data table support private UIExtendedDataTable table; private SimpleSelection selection = new SimpleSelection(); public Set<T> getSelectedRecords() { Set<T> selected = new HashSet<T>(); Iterator<Object> iterator = selection.getKeys(); while (iterator.hasNext()) { Object key = iterator.next(); table.setRowKey(key); selected.add((T) table.getRowData()); } return selected; } public T getSingleSelectedRecord(){ if(getSelectedRecords().iterator().hasNext()) return getSelectedRecords().iterator().next(); else return null; } public UIExtendedDataTable getTable() { return table; } public void setTable(UIExtendedDataTable table) { this.table = table; } public SimpleSelection getSelection() { return selection; } public void setSelection(SimpleSelection selection) { this.selection = selection; } }
-
3. Re: ExtendedDataTable rerender and action ordering
ilya_shaikovsky May 28, 2009 2:37 AM (in response to jaand96)could you please create a sample for us? because you code looks just fine.. and not sure where the problem could lie.. Or at list simplify the code to be able to post it without cutting "unnesessary" parts..
B.t.w. If something changed if you will remove binding from the table? -
4. Re: ExtendedDataTable rerender and action ordering
jaand96 May 28, 2009 9:36 AM (in response to jaand96)thanks Ill try to create an isolated test case.
One thing I forgot to mention is that if I change an exiting object in the table the change shows after the rerender.
Added/removed objects does not show up.
Oh and if I remove the table binding, I don't know how to get the selected record... -
5. Re: ExtendedDataTable rerender and action ordering
jaand96 Jun 3, 2009 10:29 AM (in response to jaand96)My mistake. This problem had nothing to do with richfaces, it was a sideeffect of bad transaction management.