5 Replies Latest reply on May 2, 2007 6:17 PM by sergeysmirnov

    oncomplete not called when last row in dataTable is removed

    gmanwani

      I am using a4j:commandLink as one of the td's inside a table to delete the current row. The oncomplete is getting called when I delete any row but the last one. Is this a known bug/issue?

        • 1. Re: oncomplete not called when last row in dataTable is remo

          could you post the code snippet ?

          • 2. Re: oncomplete not called when last row in dataTable is remo
            gmanwani

            Hi Sergey...

            In my original code I have 4 tds but for brevity I am posting just 2 tds.. one is a data item (my custom component) and the second is an image for a delete icon.

            I have a button on the page which needs to be displayed after all the rows have been deleted.

            
            <t:div id="top_div" styleClass="table_wrap">
            
             <t:dataTable id="top_div_table" var="targetVO"
             value="#{targetvolist}" styleClass="grid bottommargin15"
             renderedIfEmpty="true" rowClasses="a,b">
            
             <t:column>
             <f:facet name="header"><t:outputText value="Target Date:" /></f:facet>
             <sfh:inPlaceEdit id="target_date" value="#{someVO.targetDate}" size="10">
             </sfh:inPlaceEdit>
             </t:column>
            
             <t:column headerstyleClass="sample" styleClass="textright">
             <a4j:commandLink actionListener="#{myMBean.removeTarget}"
             styleClass="delete_button_small_left" title="Remove" reRender="top_div"
             oncomplete="Goals.checkTableRows('top_div_table');">
             <f:param name="targetId" value="#{someVO.targetId}" />
             <f:param name="goalId" value="#{objid}" />
             <a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender" />
             </a4j:commandLink>
             </t:column>
             </t:dataTable>
            
            </t:div>
            
            


            • 3. Re: oncomplete not called when last row in dataTable is remo
              gmanwani

              Quick update.. the oncomplete gets called if I set renderedIfEmpty="true". Initially I had set that property to be "false".

              I would really like to use renderedIfEmpty="false" because if I don't then the "header" facets show up even if the table is empty :(

              • 4. Re: oncomplete not called when last row in dataTable is remo
                zenshai

                hey speaking of that...

                sergey can we start a JIRA feature request to add renderedIfEmpty to the new sortable rich:datatable thats supposed to be in the works?

                seems like a generally useful feature, i know i'd use it.

                • 5. Re: oncomplete not called when last row in dataTable is remo

                  gmanwani, you use 'top_div_table' as an argument for oncomplete function. I thing when the table is empty and flag set to false, there is not any representative of the component on the page. May be oncomplete is called but failed because misses this id ?