Hello,
I need to dynamically add and delete rows to/from data table (tomahawk's one). Adding rows works OK. But deleting a row works only first time. Below is part of page and controller code responsible for displaying table and deleting rows. Scenario is following:
1) adding several rows to table (no code here)
2) deleting one row. Everything is OK, row deleted
3) deleting second row. Method HtmlDataTable.getRowIndex() returns -1.
Curently I am using Ajax4JSF 1.1.0 and JSF Sun RI 1.1_02-b08. Same thing with MyFaces 1.1.4 and 1.1.5. But with JSF 1.1_01 everything works OK (except that Ajax4JSF works only starting from third request). App. server is Web Sphere 6.1
Thank you in advance for help.
Part of JSP code:
<t:dataTable id="propertiesTable" value="#{pc_ObjectDynamicInfoTile.properties}" var="prop" rows="30" headerClass="table_header" columnClasses="standard" style="width:100%" renderedIfEmpty="false"> <t:column style="text-align:center"> <f:facet name="header"> <h:outputText value="Property type" /> </f:facet> <h:outputText value="#{prop.propType}"/> </t:column> <t:column style="text-align:center"> <f:facet name="header"> <h:outputText value="Property value" /> </f:facet> <h:outputText value="#{prop.value}" rendered="#{prop.type == 'date'}"> <f:convertDateTime pattern="dd.MM.yyyy"/> </h:outputText> <h:outputText value="#{prop.value}" rendered="#{prop.type == 'text'}"/> </t:column> <t:column style="width: 18px; text-align: center;" id="column"> <a4j:commandButton image="/theme/pictures/delete_1.gif" actionListener="#{pc_ObjectDynamicInfoTile.deleteProperty}" immediate="true" reRender="propTable"/> </t:column> </t:dataTable>
public void deleteProperty(ActionEvent evt) { int idx = getPropertiesTable().getRowIndex(); properties.remove(idx); }
Looks like I made a mistake. The thing works with JSF 1.1, at least in MANIFEST.MF of jsf-impl.jar implementation and specification version is simply 1.1.