[RF4.2] Best practice for site navigation with panelMenuItem and dataScroller ?
jadtn Sep 3, 2012 9:55 AMHi,
i'm interesting to have your opinion about 2 cases of navigation with panelMenuItem to navigate accross differents pages and datascroller to navigate in a result.
Case 1: site navigation with panelMenuItem
I use a page template a with a rich:panelMenu for page navigation on the left and on the right the content of the page with specific forms.
The navigation use a panelMenuItem with mode 'server'.
Suppose I ve 2 pages : pagex and pagey with for each 2 forms : 1 for the navigation ,1 for the purpose of the page .
When I m on pagex, then beanx is created for formx , now I decide to navigate on pagey ( whitout doing something in formx), the page is restored (jsf) before navigate! Also if I've a bean with init from db ...I do it for nothing... I don't want that, the user want to change page and not fill formx.
So I thing for navigation, panelMenuItem with mode server or ajax is not adapted for site navigation and this is client mode who is need
and finally panelMenuItem will be changed to something like this:
<rich:panelMenuItem mode="client >
<a href="/pagex.jsf" >pagex</a>
</rich:panelMenuItem >
<a href="/pageyjsf" >pagex</a>
</rich:panelMenuItem >
Are you agree with this reflexion about menu to navigate on a site? Or you know a better solution?
Case 2: navigation with scrollBar where each item have inputs.
Now what do you think about navigation inside a result like a dataGrid using rich:dataScroller
If I use for example a datagrid to present some items, at each time i navigate the previous/next element , then the current page is 'restored' , validated etc...
Then the only 'optimizations' can be bypassUpdates immediate
<rich:dataScroller bypassUpdates="true" immediate="true" />
Are you agree or you know better way?
CASE 1
pagex.xhtml
....
<h:form id="left_menu">
<rich:panelMenu ... >
<rich:panelMenuGroup label="Group 1">
<rich:panelMenuItem mode="server "label="Item 1.1" name="pagex/>
<rich:panelMenuItem mode="server "label="Item 1.2" name="pagey" />
......
<h:form>
<h:form id="formx">
<h:input value"#{beanx}"/>
</h:form>
....
<h:form id="left_menu">
<rich:panelMenu ... >
<rich:panelMenuGroup label="Group 1">
<rich:panelMenuItem mode="server "label="Item 1.1" name="pagex/>
<rich:panelMenuItem mode="server "label="Item 1.2" name="pagey" />
......
<h:form>
<h:form id="formyy">
<h:input value"#{beany}"/>
</h:form>
CASE 2
<rich:dataGrid value="#{carsBean.allInventoryItems}" var="car" columns="1" elements="1" >
<h:input value ="#{car.comment}">
<h:command action="#{beanx.save}"/>
<f:facet name="footer">
<rich:dataScroller />
</f:facet>
</rich:dataGrid>