You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Johnny Gonzalez <jo...@yahoo.es> on 2006/03/03 13:13:29 UTC

dataScroller scope problem

Hello Everybody,

I'm trying to add dataScroller funcionality to a page
in which I have a list of elements (datatable), so I
modified and added all stuff related to the
dataScroller, like in the myfaces examples at Irian
(http://www.irian.at/myfaces/dataScroller.jsf), to my
JSP. 

The page with the list appears with the navigation
buttons (to go pages back or forward) The number of
pages and elements found appear ok, but when I click
on next page, for example, it navigates but all
buttons for page navigation disappear, and I cannot go
back to the last page listing, the only way is to
press Back button in Mozilla :-(.

My JSP looks like this:

<h:panelGroup id="body">
						 <t:dataTable id="packsList" 
						   
value="#{PackAdminBean.packsList}"
							var="lstPacksVar" 		            	    		     
              
							border="0"					
							headerClass="tableHeader"
							rowClasses="tableRow1,tableRow2"
							preserveDataModel="false"
			                rows="5">
								<h:column>
									<f:facet name="header">
										<f:verbatim>Package Name</f:verbatim>
									</f:facet>
									<h:outputText
value="#{lstPacksVar.nombre}"/>
								</h:column>
								<h:column>
									<f:facet name="header">
										<f:verbatim>Product</f:verbatim>
									</f:facet>
									<h:outputText value="Lawyer"/>
									<f:verbatim><br></f:verbatim>									
									<h:outputText value="Accountant"/>
									<f:verbatim><br></f:verbatim>									
									<h:outputText value="Info"/>
									<f:verbatim><br></f:verbatim>									
									<h:outputText value="Document"/>
								</h:column>
								<h:column>
									<f:facet name="header">
										<f:verbatim>Quantity</f:verbatim>
									</f:facet>
									<h:outputText
value="#{lstPacksVar.lawyer}"/>
									<f:verbatim><br></f:verbatim>
									<h:outputText
value="#{lstPacksVar.accountant}"/>
									<f:verbatim><br></f:verbatim>									
									<h:outputText
value="#{lstPacksVar.info}"/>
									<f:verbatim><br></f:verbatim>									
									<h:outputText
value="#{lstPacksVar.docs}"/>									
								</h:column>
								<h:column>
									<f:facet name="header">
										<f:verbatim>Value</f:verbatim>
									</f:facet>
									<h:outputText 
									value="#{lstPacksVar.price}"/>
								</h:column>
								<h:column>
									<f:facet name="header">
										<f:verbatim>Modify</f:verbatim>
									</f:facet>
									 <h:commandLink
									 
actionListener="#{PackAdminBean.selectPack}"
									  action="ModifyPack">
										<h:graphicImage value="images/edit.gif" 
											alt="Edit Pack" 
											width="15%"
											style="border:0">										
										</h:graphicImage>
										 <f:param name="paqueteID" 
										 	value="#{lstPacksVar.id}"/>
									 </h:commandLink>
								</h:column>
						</t:dataTable>	
						
						 <h:panelGrid columns="1" >
				            <t:dataScroller id="scroll_1"
				                    for="packsList"
				                    fastStep="10"
				                    pageCountVar="pageCount"
				                    pageIndexVar="pageIndex"
				                    styleClass="scroller"
				                    paginator="true"
				                    paginatorMaxPages="9"
				                   
paginatorTableClass="paginator"
				                   
paginatorActiveColumnStyle="font-weight:bold;"
				                   
actionListener="#{PackAdminBean.scrollerAction}"
				                    >
				                <f:facet name="first" >
				                    <t:graphicImage
url="images/arrow-first.gif" border="1" />
				                </f:facet>
				                <f:facet name="last">
				                    <t:graphicImage
url="images/arrow-last.gif" border="1" />
				                </f:facet>
				                <f:facet name="previous">
				                    <t:graphicImage
url="images/arrow-previous.gif" border="1" />
				                </f:facet>
				                <f:facet name="next">
				                    <t:graphicImage
url="images/arrow-next.gif" border="1" />
				                </f:facet>
				                <f:facet name="fastforward">
				                    <t:graphicImage
url="images/arrow-ff.gif" border="1" />
				                </f:facet>
				                <f:facet name="fastrewind">
				                    <t:graphicImage
url="images/arrow-fr.gif" border="1" />
				                </f:facet>
				            </t:dataScroller>
				           </h:panelGrid>
					    </h:panelGroup>


In my Bean (PackAdminBean), I have added the
method that manages the navigation process, like this:


 public void scrollerAction(ActionEvent event)
	 {
		
	        ScrollerActionEvent scrollerEvent =
(ScrollerActionEvent)event;
	       
FacesContext.getCurrentInstance().getExternalContext().
	        log("scrollerAction: facet: " +
scrollerEvent.getScrollerfacet() + 
	        		", pageindex: " +
scrollerEvent.getPageIndex());
	       
	 }


I though it was because my Bean in the
faces-config.xml has "request" scope, so I changed it
to application, like in the examples, but its
behaviour is the same.

I went to Jboss console looking for more information
and I found that:

1. When the dataScroller (datatable) page is loaded
There's no output in jboss console.
2. If I click Next button in the first page I get in
console this:

02:06:07,106 INFO  [[/mycontext]] scrollerAction:
facet: next, pageindex: -1

so, in the navigator appears the next page, but the
buttons are not displayed.

3. I ended my session in the application and login
again and click on Fast Forward button, then in
console appears:


02:09:31,798 INFO  [[/mycontext]] scrollerAction:
facet: fastf, pageindex: -1

it does the FastForward, but navigation buttons
disappear

4. If I click on First page being on it I get:

02:12:25,213 INFO  [[/sajur]] scrollerAction: facet:
first, pageindex: -1


I see that pageindex is always -1, is this normal?

What could the problem be?

Thanks a lot,
Johnny


		
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com