0 Replies Latest reply on Aug 23, 2007 1:09 AM by Qasim Khan

    reRender DataTable from within a table

    Qasim Khan Newbie

      Hi,

      I am using rich data table for displaying data. and using a delete button in every row of the data table. Delete button works fine but the problem is in reRendring the table after deleting the data it is not refreshing the table. Whereas I am also adding and Updating the record outside the datatable it works fine and also update the datatable.

       <a4j:region selfRendered="true">
       <a4j:status startStyle="font-color:Red" startText="Processing.."/>
      
       <a4j:form id="DTForm" >
       <a4j:region id="dtr" selfRendered="true">
       <a4j:outputPanel ajaxRendered="true">
       <rich:dataTable value="#{BatchInfoController.list}"
       onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
       onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
       border="0" id="batchInfoDT"
       cellpadding="0" cellspacing="0"
       var="DTData" columnClasses="col"
       rows="10" width="400" >
       <f:facet name="header">
       <rich:columnGroup>
       <rich:column colspan="3">
       <h:outputText value="AJAX Example" />
       </rich:column>
       </rich:columnGroup>
       </f:facet>
       <rich:column>
       <f:facet name="header">
       <h:outputText value="ID"/>
       </f:facet>
       <h:outputText id = "id" value="#{DTData.batchId}" />
       </rich:column>
      
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Description" />
       </f:facet>
       <h:outputText id = "des" value="#{DTData.description}"/>
       </rich:column>
      
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Select/Delete" style="text-align:center" />
       </f:facet>
       <h:commandButton id ="btn_id" value="..." type="button" onclick="sendVal(this,'#{DTData.batchId}','#{DTData.description}')" styleClass="Button" />
      
      
       <h:commandButton value="..." type="button" styleClass="Button">
       <a4j:support event="onclick"
       reRender="batchInfoDT,status,dtr" action="#{BatchInfoController.removeData}"
       onsubmit="if(confirm('Are you sure to delete the record ?'))
       {sendVal(this,'#{DTData.batchId}','#{DTData.description}');}
       else{
       form.reset(); return false;
       }"
       oncomplete="resett()"/>
       </h:commandButton>
      
       </rich:column>
      
       <f:facet name="footer">
       <rich:datascroller for="batchInfoDT" maxPages="20"/>
       </f:facet>
       </rich:dataTable>
       </a4j:outputPanel>
       </a4j:region>
       <h:panelGrid columns="2">
       <h:outputText value="ID" styleClass = "OUTPUT"/>
       <h:inputText id="id" value="#{BatchInfoController.batchInfo.batchId}" required="true" styleClass = "INPUT1"/>
      
      
       <h:outputText value="Description" styleClass = "OUTPUT"/>
       <h:inputText id="des" value="#{BatchInfoController.batchInfo.description}" required="true" styleClass = "INPUT1"/>
      
       </h:panelGrid>
       <h:commandButton value="Save" type="button" styleClass="Button">
       <a4j:support event="onclick"
       reRender="batchInfoDT,status" action="#{BatchInfoController.saveData}"
       onsubmit="if(validateInput()== false){return false;}"
       oncomplete="resett()"/>
       </h:commandButton>
       <h:commandButton type="button" value="Edit" styleClass = "Button">
       <a4j:support event="onclick"
       reRender="batchInfoDT,status" action="#{BatchInfoController.editData}"
       onsubmit="if(validateInput()== false){return false;}"
       oncomplete="resett()"/>
       </h:commandButton>