A4j:htmlcommandlink rerender problem inside rich:datagrid
m_kavand Apr 15, 2010 8:51 AMI have a t:datatable as a parent table and a rich:datagrid as a child table on a page.selecting one row of parent rerender the whole child rich:datagrid that has an A4j:htmlcommandlink inside every cell.
The problem is that the htmlcommandlink does now trigger the action on the server and I know that it’s related to rerendering the rich:datagrid .I follow up the instruction based on livedemo for ajaxform at http://livedemo.exadel.com/richfaces-demo/richfaces/form.jsf :
a4j:form functionality is similar to the standard h:form component except two additional features:
- Along with a4j:htmlCommandLink, it fixes the problem of h:commandLink component that cannot be re-rendered without re-rendering the whole form it belongs to.
- It might convert all non-ajax action components (including the third party components) to the ajaxian ones if ajaxSubmit attribute is set to true
h:commandLink renderer generates the javascript code that is used to submit the form when the link is clicked. However, if the h:commandLink is rendered outside of the form, for example, when you point to it with reRender, the wrong code is generated that causes the broken functionality when user clicks this link later. The example of problematic code is below. To fix the code, you need to replace h:form with a4j:form and h:commandLink with a4j:htmlCommandLink.
Based on this document I replaced <h:form> with <a4j:form> and <h:commandLink> with the <a4j:htmlCommandlink>,but the problem not fixed. The code that is related to child table is as follows:
<a4j:form>
<t:dataTable id=”parent” value=”…”>
<h:column >
<t:commandLink value="…" action=”…” rerender=”child”
</t:commandLink>
</h:column>
</t:dataTable>
<a4j:outputPanel layout="none">
<rich:dataGrid binding="#{showAdvMBean.subCatHtmlDataGrid}" var="subcatVar" id="child" rendered="#{showAdvMBean.renderSubCats}"
value="#{showAdvMBean.subCategories}" columns="9" elements="9"
>
<a4j:htmlCommandLink id="something" value="#{subcatVar.title}" action="#{showAdvMBean.doListAction}" >
<f:setPropertyActionListener target="#{showAdvMBean.selectedCatID}" value="#{subcatVar.childID}" />
</a4j:htmlCommandLink>
</rich:dataGrid>
</a4j:outputPanel>
</a4j:form>
I think the problem is related to rerendering child table area and because of the a4j:htmlCommandLink inside the child grid does not work.any idea could help me to find the problem.thanks