-
1. Re: a4j:region inside a4j:repeat
sergeysmirnov Apr 20, 2007 5:20 PM (in response to obalas)region does not limit the traffic to the server anyhow. ajaxSingle does.
P.S. I wonder why selfRendered="true" ? -
2. Re: a4j:region inside a4j:repeat
obalas Apr 21, 2007 6:47 AM (in response to obalas)Hello, Sergey, thank you for your quick response.
My scope is to have a list of checkboxes in a form, and, when clicking on one of them, only that one to be submitted, like this:<a4j:form> <a4j:repeat value="#{SomeBean.someItems}" var="item"> <a4j:region> <h:selectBooleanCheckbox value="#{SomeBean.someVar}"> <a4j:support actionListener="#{SomeBean.someMethod}" event="onclick" /> </h:selectBooleanCheckbox> </a4j:region> </a4j:repeat> </a4j:form>
This code is not working, unfortunatelly, the problem is the existence of a4j:region inside a4j:repeat, as explained in my first post :(
Then I tried a different approach, giving up the ideea of having a region and having instead a form for each checkbox, like this:<a4j:repeat value="#{SomeBean.someItems}" var="item"> <a4j:form ajaxSingle="true"> <h:selectBooleanCheckbox value="#{SomeBean.someVar}"> <a4j:support actionListener="#{SomeBean.someMethod}" event="onclick" /> </h:selectBooleanCheckbox> </a4j:form> </a4j:repeat>
The problem here is when i click on a checkbox, all forms are submitted (e.g. the setters methods in the backing bean, are called for every checkbox, not only the ones in the current submitted form). AjaxSingle does not help very much here, maybe I put it in a wrong place?
Any ideea on how to prevent this?
Thank you in advance,
Ovi -
3. Re: a4j:region inside a4j:repeat
sergeysmirnov Apr 21, 2007 10:17 AM (in response to obalas)Ovi, you put all eggs in one basket.
Getters and setters of the backing beans are invoked several times during the JSF lifecycle. This is like JSF works. You cannot prevent it. Does not matter it is Ajax or not.
you need to add ajaxSingle=true to the a4j:support, but not to a4j:form.
I.e. <a4j:support ajaxSingle="true"..... />
Having ajaxSingle=true on the a4j:form without ajaxSubmit just does not make sense. DO NOT add so many forms
a4j:region is not allowed inside a4j:repeat (or any other iteration component kind )
This is an example of table where rows are updated.
http://localhost/richfaces-art-datatable/pages/example10.jsf
Only the second table uses <a4j:support ajaxSingle="true" ..../>
If you have FireFox with FireBug extension, you can see that in the first table all four number are submitted. In the second case, only that just edited.