-
1. Re: Dynamic a4j:commandLink is not invoking action method
michpetrov Jul 20, 2015 6:47 AM (in response to kkn)Hard to say without seeing the code. How are you generating the button?
-
2. Re: Dynamic a4j:commandLink is not invoking action method
kkn Jul 22, 2015 2:00 AM (in response to michpetrov)So, I have an Add button. On click of add button, a new record is added into t:dataTable. This t:dataTable has a<a4j:commandLink> which is dynamically generated by hitting the ADD button. This delete link is not able to perform its ajax action.
Code is as below
<a4j:region >
<a4j:outputPanel id="sectionData" ajaxRendered="true">
<table id="sectionTable">
<t:dataList
id="sectionList"
value="${handlerBean.sectionList}"
var="obj"
rowIndexVar="index"
forceId="true"
>
<tr>
<td>
<h:outputText
id="sectionDescr"
value="#{obj.sectionDescr}"
rendered="#{not isEditable}"
/>
<input
type="hidden"
id="sectionId#{index}"
name="sectionId#{index}"
value="#{obj.sectionId}"
/>
<h:selectOneMenu
id="section#{index}"
value="#{obj.sectionId}"
rendered="#{isEditable}"
>
<f:converter converterId="JSF12StringConverter" />
<f:selectItem itemLabel="-- Select --" itemValue=" " />
<f:selectItems value="#{obj.sectionMap}" />
</h:selectOneMenu>
</td>
<td>
<h:panelGroup id="valueType#{index}">
<h:panelGroup rendered="${obj.valueType eq Percent}">Percent</h:panelGroup>
<h:panelGroup rendered="${obj.valueType eq Amt}">Amount</h:panelGroup>
</h:panelGroup>
</td>
<td class="deleteIconClass">
<h:panelGroup rendered="${('Y' eq obj.infoFlag) or isEditable}">
<a4j:commandLink
id="deleteId"
status="newState"
render="sectionData"
action="#{handlerBean.deleteSection}"
immediate="true"
>
<f:param name="deletedIndex" value="${index}" />
</a4j:commandLink>
</h:panelGroup>
</td>
</tr>
</t:dataList>
<tr >
<td colspan="3">
<span class="addButton">
<a4j:commandLink
id="addId"
value="ADD"
render="sectionData"
action="#{handlerBean.addNewSection}"
immediate="true"
/>
</span>
</td>
</tr>
</table>
</a4j:outputPanel>
</a4j:region>
Not sure if its the issue with using t:dataTable. I tried with c:forEach as well but it does not seem to work
-
3. Re: Dynamic a4j:commandLink is not invoking action method
michpetrov Jul 22, 2015 4:06 AM (in response to kkn)If you're just adding a row into the table there shouldn't be a problem, is it only on the new rows where the button doesn't work?
-
4. Re: Dynamic a4j:commandLink is not invoking action method
kkn Jul 22, 2015 12:58 PM (in response to michpetrov)For existing records, I do not have delete button as I do not want user to delete the existing record. Only when a new record is added using ADD a4j link, the dynamically added record's delete button is not able to perform ajax functionality.
-
5. Re: Dynamic a4j:commandLink is not invoking action method
michpetrov Jul 23, 2015 3:59 AM (in response to kkn)And if you enable it anyway? There might be a problem with the listener itself, not with it being dynamically added.
-
6. Re: Dynamic a4j:commandLink is not invoking action method
kkn Jul 24, 2015 4:42 AM (in response to michpetrov)Even after enabling it for all, it is not working. What can be the problem with the listener?
So but I am facing this problem at other places where I am dynamically rendering a section on page which has components with a4j:ajax. And I am not able to make it work at any place. So for example, similar to commandLink (delete in above example), I have a inputText with a4j:ajax functionality which is dynamically rendered. Once the section is rendered dynamically, inputText is not able to fire ajax event. Putting the inputText outside of dynamic section is working here. One thing is common between the two examples. Both are under a t:dataTable tag.
So, I am wondering if its the issue with dynamic contents + t:dataTable tag. Can you please explain what kind of issue is with listener?
Thank you!
Khush
-
7. Re: Dynamic a4j:commandLink is not invoking action method
michpetrov Jul 24, 2015 6:34 AM (in response to kkn)I do not know how t:dataTable works, it's possible there's some incompatibility with RichFaces. We have a functionality in place that visits the component tree looking for execute/render ids and some other things, it's possible the visit into the datatable is not happening correctly.
-
8. Re: Dynamic a4j:commandLink is not invoking action method
kkn Jul 24, 2015 11:56 AM (in response to michpetrov)This seems to work with 3. Not sure if its richfaces or tomahawk issue. Can you suggest some other way to do this? I am stuck on all the places where we are adding content dynamically.
-
9. Re: Dynamic a4j:commandLink is not invoking action method
michpetrov Jul 27, 2015 4:57 AM (in response to kkn)Well, do you need the t:dataTable? RichFaces and JSF both have a dataTable component.
-
10. Re: Dynamic a4j:commandLink is not invoking action method
kkn Jul 29, 2015 12:44 PM (in response to michpetrov)Well, I wanted to try couple of things before replying to the thread but none seem to work for me
I have tried with c:forEach. But have come across some issues. Were you able to replicate it using t:dataTable? Or richfaces 4 no longer supports t tags?
Thank you so much for all the help!
Khush
-
11. Re: Dynamic a4j:commandLink is not invoking action method
michpetrov Jul 30, 2015 4:31 AM (in response to kkn)Tomahawk is a framework from Apache, we don't support it. c:forEach won't work, the components you generate don't have access to the variable you iterate over, why not try rich:dataTable?