This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes I need help with ajaxSingle, reRender and immediate. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "I need help with ajaxSingle, reRender and immediate." Watch "I need help with ajaxSingle, reRender and immediate." New topic
Author

I need help with ajaxSingle, reRender and immediate.

Fernando Soto Martorell
Greenhorn

Joined: May 21, 2010
Posts: 6
Hi, I need help with this pages, I had proved with several combinations but i can't get make to work as desired.

I have a page in Web-Content/admin/unidad/default.xhtml:



the content of /admin/unidad/list.xhtml:



the action of the btInsert buttom navigate to /admin/unidad/admin.xhtml:



the content of /admin/templates/admin.xhtml:



This is the situation:

When I'm in the list(/admin/unidad/list/xhtml) and select an item of the "cmbEmpresa" selectOneMenu, the"cmbUnidad" and "cmbCentroCosto" selectOneMenus are rerendered with the new list of SelectItems, thaks ok, but when I click in the "btInsert", the grid is rerendered with filtered values, and when I click it again (the btInsert commandButtom) is when navigate to /admin//unidad/admin.xhtml. The navigation rule have not the redirect directive thus i always see http://localhost:8080/webrctel/admin/unidad/default.html.

Something similar in the /admin/unidad/admin.xhtml page, when the "cmbEmpresa" selectOneMenu changes, the"cmbUnidad" and "cmbCentroCosto" selectOneMenus are rerendered with the new list of SelectItems, but if the "btBack" is clicked, again the same problem, first rerender the seleconemenus ignoring the immediate=true and then, in the second click navigate.

How I can Solve this problem and make them work correctly?

The app is running in Tomcat 6.20, with JSF 1.2_07-b03-FCS.

Thanks in advance.>
Max Katz
Ranch Hand

Joined: Aug 03, 2009
Posts: 72
You should post a simpler example.. to much code.

reRender - points to component id's you want to render (after an Ajax request).

For example:
reRender="id"
or
reRender="id1, id2, id3"
or
reRender="#{bean.renderComponents}"

ajaxSingle - processes only the current component when you fire an Ajax request. No other components on the page will be processed (go thru the life cycle). This article will help you more with ajaxSingle: http://mkblog.exadel.com/ria/richfaces-region-partial-jsf-tree-processing/

immediate - for input components, will execute Process Validations phase for this component during Apply Request Values phase. For action components, will execute Invoke Application phase during Apply Request Values phase.

Hope this helps...

Max
http://mkblog.exadel.com
Fernando Soto Martorell
Greenhorn

Joined: May 21, 2010
Posts: 6
Well. sorry for the bunch of code, i've posted all the code in case the error is in other component.

I'll explain the problen with minimal code...

In a page are severals selectOneMenu, wich are used to filter a data in a rich:dataTable.
When the first (selectOneMenu) is changed, the others selectOneMenu must be rerendered with new data filtred by the first selectOneMenu, but cant rerender the dataTable. That works fine.
When the first selectOneMenu is unchanged, the commandButton do the navigation, but if the selectOneMenu is changed, the commandButton in the first click rerenders the dataTable, and in the second click, is when navigate.
What I whant is when the button is clicked, go ahead with the navigation rather than rerender the grid.
Max Katz
Ranch Hand

Joined: Aug 03, 2009
Posts: 72
a4j:commandButton shouldn't be used for navigation, it fires an Ajax request and does a partial page update. To force a4j:commandButton to navigate you need to set <redirect/> in navigation rules. It's better to use standard h:commandButton for navigation.

Max
http://mkblog.exadel.com
 
Consider Paul's rocket mass heater.
 
subject: I need help with ajaxSingle, reRender and immediate.
 
Similar Threads
problem on saving inputText values
Ajax status doesn't stop in IE8
Rich:Datatable rerendering problem
RichFaces with TabPanel and selectOneMenu not change the tab
Richfaces Scrollable Datatable with filtermethod not working