ExtendedDataTable with onselectionchange support blocking re
ultrapod Oct 6, 2008 3:32 PMi think i'm having a problem with rerendering an extendedDataTable that has an <a4j:support event="onselectionchange"/> attached to it. i could be wrong about this, but i'm hoping someone can shed some light on this for me.
simply put, i have a page with two extendedDataTables on it, in a sort of "master-detail" arrangement. selecting a row (or rows) from the "master" table will display just the selected rows in the "detail" table. this is a simple enough arrangement, and it works quite well once i add the now-functional <a4j:support event="onselectionchange"/> support.
the problem i'm having occurs in my implementation of a "clear" button. basically, when i hit the "clear" button, i want to clear the contents of the "detail" table and return the "master" table to a state where nothing is selected - in effect, returning the page to the visual state when it was first loaded. i can get the "detail" table to rerender as expected, but the "master" table will not rerender.
my jsp:
<f:view> <a4j:form id="test_form"> <h:outputText value="Master table"/> <rich:extendedDataTable rowKeyVar="rkv" height="140px" width="280px" id="master_table" value="#{TestbedBean.masterValues}" var="master" sortMode="single" selectionMode="multi" binding="#{TestbedBean.masterTable}" selection="#{TestbedBean.masterSelection}"> <rich:column width="60px" id="master_id_col" label="ID" sortable="true" sortBy="#{master}"> <f:facet name="header"> <h:outputText id="master_id_col_hdr_txt" styleClass="headerText" value="ID" /> </f:facet> <h:outputText id="master_id_text" value="#{master}"/> </rich:column> <a4j:support id="a4j_support_master" reRender="detail_table" event="onselectionchange" /> </rich:extendedDataTable> <br> <h:outputText value="Detail table"/> <rich:extendedDataTable rowKeyVar="rkv" height="140px" width="280px" id="detail_table" value="#{TestbedBean.detailValues}" var="detail" sortMode="single" selectionMode="multi" binding="#{TestbedBean.detailTable}" selection="#{TestbedBean.detailSelection}"> <rich:column width="60px" id="detail_id_col" label="ID" sortable="true" sortBy="#{detail}"> <f:facet name="header"> <h:outputText id="detail_id_col_hdr_txt" styleClass="headerText" value="ID" /> </f:facet> <h:outputText id="detail_id_text" value="#{detail}" /> </rich:column> </rich:extendedDataTable> <a4j:commandButton id="clear_tables" immediate="true" value="Clear Tables" action ="#{TestbedBean.clearTables}" reRender="master_table,detail_table"/> <rich:messages id="messages" ajaxRendered="true" globalOnly="true" styleClass="font_size_eight_point" errorClass="red" /> <br> <br> <a4j:log popup="false" level="ALL"/> </a4j:form> </f:view>
my backing bean:
public class TestbedBean { private static Logger logger = Logger.getLogger(TestbedBean.class.getName()); protected SimpleSelection masterSelection = new SimpleSelection(); protected UIDataTable masterTable; protected SimpleSelection detailSelection = new SimpleSelection(); protected UIDataTable detailTable; public List getMasterValues() { return new ArrayList<String>(Arrays.asList(new String[]{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"})); } public List getDetailValues() { ArrayList<Object> retval = new ArrayList<Object>(); Iterator<Object> iterator = masterSelection.getKeys(); while (iterator.hasNext()) { Object key = iterator.next(); masterTable.setRowKey(key); if (masterTable.isRowAvailable()) { retval.add(masterTable.getRowData()); } } return retval; } public String clearTables() { masterSelection = new SimpleSelection(); masterTable = null; detailSelection = new SimpleSelection(); detailTable = null; return ""; } public SimpleSelection getMasterSelection() { return masterSelection; } public void setMasterSelection(SimpleSelection masterSelection) { this.masterSelection = masterSelection; } public UIDataTable getMasterTable() { return masterTable; } public void setMasterTable(UIDataTable masterTable) { this.masterTable = masterTable; } public SimpleSelection getDetailSelection() { return detailSelection; } public void setDetailSelection(SimpleSelection detailSelection) { this.detailSelection = detailSelection; } public UIDataTable getDetailTable() { return detailTable; } public void setDetailTable(UIDataTable detailTable) { this.detailTable = detailTable; } }
the reason i think that this might be a bug is that the <a4j:log> reports a warning and a few errors when i click on "clear tables". here they are:
... warn[15:29:00,234]: Node for replace by response with id test_form:master_table:0 not found in document ... error[15:29:00,236]: New node for ID test_form:master_table:master_id_colmenu_menu_script is not present in response ... error[15:29:00,236]: New node for ID test_form:master_table:j_id32_menu_script is not present in response ...
i'm using a recent (october 2, i believe) nightly build of richfaces 3.3.0. any help would be much appreciated!