Pregunta

estoy desarrollando una aplicación web Seam-Jsfv1.2-EJB3. Tengo una tabla de datos y casillas de verificación en cada fila. Por otra parte, tengo una datascroller en el fondo de mi mesa también.

Mi problema es cuando hago clic en el siguiente número de página de la barra de desplazamiento, las casillas de verificación seleccionadas en la primera página de la tabla de datos se ha ido. Es decir, aunque hayan sido seleccionados, haga clic en la página siguiente hacerlos sin seleccionar. Lo veo volviendo a la primera página de nuevo haciendo clic en la barra de desplazamiento.

¿Tiene alguna idea acerca de ese problema? Con el fin de clearify mi caso, les adjunto mi código a continuación:

<rich:dataTable
            id="apiV2ProductList" rows="10" var="_apiV2Product"
            value="#{apiV2ProductList.resultList}"
            rendered="#{not empty apiV2ProductList.resultList}" reRender="ds">
            <rich:column>
                <f:facet name="header"> 
                    <h:selectBooleanCheckbox id="selectionCheckAll" onclick="selectAll()" /> 
                </f:facet>
                <h:selectBooleanCheckbox id="selectionCheck" onclick="increase(this)" value="#{_apiV2Product.selectValue}" >  
                </h:selectBooleanCheckbox>
            </rich:column>

...

<f:facet name="footer">
                <rich:datascroller id="ds" renderIfSinglePage="false">
                </rich:datascroller>
            </f:facet>

Muchas gracias de antemano. Baris

¿Fue útil?

Solución 2

Adding an a4j support tag between scroller has solved my problem:

<f:facet name="footer">
  <rich:datascroller id="ds" renderIfSinglePage="false">
   <a4j:support event="onpagechange"/> 
  </rich:datascroller>
</f:facet>

However the other thing is, I am using JQuery to style my table (ex. on mouse over and out), and this time, when I click the next page of my table, the style is gone.

Any help would be great, many thanks in advance.

** PS: BTW the wierest thing to my mind is it comes me impossible to find a solution by yourself for this kind of problems. Your creation may not always be enough to solve (at least here in my example, adding a4j:support thing) I am asking experts, how can we handle that kind of things by ourselves... **

Otros consejos

You can extend the org.richfaces.renderkit.html.DatascrollerTemplate write your own DataScroller for your own styling by adding a component with the below configuration in faces-config.xml

<component>
    <component-type>exCustHtmlDatascroller</component-type>
    <component-lass>org.jsf.common.ui.EXCustHtmlDatascroller</component-class>
</component>
<render-kit>
  <renderer>
      <component-family>org.richfaces.Datascroller</component-family>
      <renderer-type>exCustDataScrollerTemplate</renderer-type>
      <renderer- class>org.jsf.common.ui.EXCustDataScrollerTemplate</renderer-class>
  </renderer>
</render-kit>

You don't need jQuery for styling the datatable

<rich:dataTable id="dataTable" var="x"  
onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"

The problem you were seeing with the styles being removed is due to the nature of AJAX, and the way the table is reRendered.

Assuming you were firing the initial styling call based on some form of page onLoad, the first time the page is rendered, your styles will be applied. However, when you click the "next" button with the paginator, you are pulling a lot of new HTML down, and replacing the old HTML in the table with the newer, updated information. The proble you're seeing is that you saw styling because jQuery applied styles to the old nodes, upon reRender, those nodes are completely thrown away, along with their styling. You simply need to figure out the hook to call the "styling" method, and re-execute that call after the table is re-rendered.

Generally, I use an a4j:status tag, and set up the onstart or onstop to re-parse the table.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top