7 Replies Latest reply on Nov 1, 2007 2:49 AM by Qasim Khan

    Problem in datascroller

    Qasim Khan Newbie

      Datascroller is not working as it should be.

      Its page navigation is random and I am preforming an action on each row as I change the page not action performs

      Here is JSF code

      <a4j:form id="DTForm" >
       <a4j:region selfRendered="true">
       <a4j:status id="stat" startStyle="font-color:Red" startText="Processing.."/>
       <h:outputText id="status" style="font-weight:bold" value="#{BatchInfoController.status}"/>
      
       <a4j:region id="dtr" selfRendered="true">
       <a4j:outputPanel ajaxRendered="true">
       <rich:dataTable value="#{BatchInfoController.list}"
       onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
       onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
       id="batchInfoDT"
       var="DTData" columnClasses="col"
       rows="10" width="400">
       <f:facet name="header">
       <rich:columnGroup>
       <rich:column colspan="3">
       <h:outputText value="AJAX Example" />
       </rich:column>
       </rich:columnGroup>
       </f:facet>
      
       <rich:column>
       <f:facet name="header">
       <h:outputText value="ID"/>
       </f:facet>
       <h:outputText value="#{DTData.batchId}" />
       </rich:column>
      
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Description" />
       </f:facet>
       <h:outputText value="#{DTData.description}"/>
       </rich:column>
      
       <rich:column>
       <f:facet name="header">
       <h:outputText value="Select/Delete" style="text-align:center" />
       </f:facet>
       <h:commandButton id ="btn_id" value="..." type="button" onclick="sendVal(this,'#{DTData.batchId}','#{DTData.description}')" styleClass="Button" />
      
       <a4j:region id="inner" selfRendered="true">
       <h:commandButton value="..." type="button" styleClass="Button">
       <a4j:support event="onclick"
       reRender="status,inner"
       status="stat" action="#{BatchInfoController.removeData}"
       onsubmit="if(confirm('Are you sure to delete the record ?'))
       {sendVal(this,'#{DTData.batchId}','#{DTData.description}');}
       else{
       resett(); return false;
       }"
       oncomplete="resett()"/>
       </h:commandButton>
       </a4j:region>
       </rich:column>
      
       <f:facet name="footer">
       <a4j:region>
       <rich:datascroller for="batchInfoDT" maxPages="5"/>
       </a4j:region>
       </f:facet>
       </rich:dataTable>
       </a4j:outputPanel>
       </a4j:region>
      
       <h:panelGrid columns="2">
       <h:outputText value="ID" styleClass = "OUTPUT"/>
       <h:inputText id="id" value="#{BatchInfoController.batchInfo.batchId}" required="true" styleClass = "INPUT1"/>
      
       <h:outputText value="Description" styleClass = "OUTPUT"/>
       <h:inputText id="des" value="#{BatchInfoController.batchInfo.description}" required="true" styleClass = "INPUT1"/>
      
       </h:panelGrid>
      
       <h:commandButton value="Save" type="button" styleClass="Button">
       <a4j:support event="onclick"
       reRender="batchInfoDT,status" action="#{BatchInfoController.saveData}"
       onsubmit="if(validateInput()== false){return false;}"
       oncomplete="resett()"/>
       </h:commandButton>
       <h:commandButton type="button" value="Edit" styleClass = "Button">
       <a4j:support event="onclick"
       reRender="batchInfoDT,status" action="#{BatchInfoController.editData}"
       onsubmit="if(validateInput()== false){return false;}"
       oncomplete="resett()"/>
       </h:commandButton>
       <h:commandButton type="button" onclick="resett()" value="Clear" styleClass="Button"/>
      
       </a4j:region>
       </a4j:form>


      Every thing works fine. As I change the page problems appear every where. not the page navigation is correct and the delete button not works even no request goes to bean.

      If am wrong some where please let me know.

      Its urgent! please

        • 1. Re: Problem in datascroller
          Qasim Khan Newbie

          I think Rich Faces team should have think about it because in most cases we need datatable and if the datatable is not right than people start moving to the other alternatives like myfaces or icefaces.

          First I was trying to select the row data through java script and than I also tried using the check box but the core problem remain same which is on page navigation request lost when we change the page.

          I tried to figure out using a4j region but not worked.

          • 2. Re: Problem in datascroller
            Dmitry Demyankov Novice

            Can you try using a4j:commandLink and a4j:commandButton instead of h:commandLink/Button?

            • 3. Re: Problem in datascroller
              Qasim Khan Newbie

              No it does not work. :(

              As I said earlier problem appears when we change the page. Request performs after 2,3 or more attempts.

              debug[17:41:39,867]: Have Event [object Object] with properties: target: undefined, srcElement: [object], type: click
              debug[17:41:39,882]: NEW AJAX REQUEST !!! with form :DTForm
              debug[17:41:39,882]: Append text control DTForm:id with value [12] and value attribute [12]
              debug[17:41:39,898]: Append text control DTForm:des with value [12] and value attribute [12]
              debug[17:41:39,914]: Append hidden control DTForm with value [DTForm] and value attribute [DTForm]
              debug[17:41:39,914]: Append hidden control autoScroll with value [] and value attribute []
              debug[17:41:39,929]: Append hidden control DTForm:_idcl with value [] and value attribute []
              debug[17:41:39,945]: Append hidden control DTForm:_link_hidden_ with value [] and value attribute []
              debug[17:41:39,945]: parameter DTForm:batchInfoDT:10:_id15 with value DTForm:batchInfoDT:10:_id15
              debug[17:41:39,976]: Start XmlHttpRequest
              debug[17:41:39,976]: Reqest state : 1
              debug[17:41:39,992]: QueryString: AJAXREQUEST=DTForm%3AbatchInfoDT%3A10%3Ainner&DTForm%3Aid=12&DTForm%3Ades=12&DTForm=DTForm&autoScroll=&DTForm%3A_idcl=&DTForm%3A_link_hidden_=&DTForm%3AbatchInfoDT%3A10%3A_id15=DTForm%3AbatchInfoDT%3A10%3A_id15&
              debug[17:41:40,007]: Have Event [object Object] with properties: target: undefined, srcElement: [object], type: click
              debug[17:41:40,023]: NEW AJAX REQUEST !!! with form :DTForm
              debug[17:41:40,039]: Append text control DTForm:id with value [12] and value attribute [12]
              debug[17:41:40,039]: Append text control DTForm:des with value [12] and value attribute [12]
              debug[17:41:40,054]: Append hidden control DTForm with value [DTForm] and value attribute [DTForm]
              debug[17:41:40,070]: Append hidden control autoScroll with value [] and value attribute []
              debug[17:41:40,070]: Append hidden control DTForm:_idcl with value [] and value attribute []
              debug[17:41:40,086]: Append hidden control DTForm:_link_hidden_ with value [] and value attribute []
              debug[17:41:40,101]: parameter DTForm:batchInfoDT:10:_id14 with value DTForm:batchInfoDT:10:_id14
              debug[17:41:40,117]: Start XmlHttpRequest
              debug[17:41:40,117]: Reqest state : 1
              debug[17:41:40,132]: QueryString: AJAXREQUEST=DTForm%3AbatchInfoDT%3A10%3Ainner&DTForm%3Aid=12&DTForm%3Ades=12&DTForm=DTForm&autoScroll=&DTForm%3A_idcl=&DTForm%3A_link_hidden_=&DTForm%3AbatchInfoDT%3A10%3A_id14=DTForm%3AbatchInfoDT%3A10%3A_id14&
              debug[17:41:40,304]: Reqest state : 2
              debug[17:41:40,320]: Reqest state : 3
              debug[17:41:40,335]: Reqest state : 4
              debug[17:41:40,335]: Reqest end with state 4


              Log for the delete request but record not deleted instead page changes to 1 from 2



              • 4. Re: Problem in datascroller
                Dmitry Demyankov Novice

                I don't quite understand.. how do you change the page? Click on page number in datascroller? I don't see datascroller's code in your code snippet..

                Maybe adding a4j:keepAlive will help :) but it's more of a guess..

                • 5. Re: Problem in datascroller
                  Qasim Khan Newbie

                  If you see in the footer of the data table I used the datascroller.

                  if we change the page through datascroller by clicking on the page number or by pressing the next previous button. Delete method which is called within the data table is uncertain.

                  I already tried keep alive option but not worked.

                  Now I removed the datascroller and every thing works fine. But in case of bulk data I think it will not be the right option.

                  I even tried scrollable datatable but it did not meet my requirement. It may be the region problem, but still not sure.

                  I really need to solve this problem, any kind of help appreciated.

                  • 6. Re: Problem in datascroller
                    Dmitry Demyankov Novice

                    Ah, sorry.. now I see it :)

                    I've used datascroller with dataGrid and it worked fine.. but it was defined outside of dataGrid.

                    Have you tried putting it after the table, not inside the footer? Just one more guess :)

                    • 7. Re: Problem in datascroller
                      Qasim Khan Newbie

                      Hi,

                      I got the problem finally.

                      In old versions where a4j 1.1 and rich faces 3.0.1 are separate. Page navigation works fine and In new releases rich faces 3.1.0 and 3.1.2 it did not work as expected.

                      and now the problem is that we can not use old rich faces with the new one due to some additional features and change in configuration.

                      So if one of the developer of Rich Faces take a look on it. I will be very thankful to him because without page navigation data table is useless and without data table Rich Faces is not remain as good as it was.

                      I hope you will take a look on it and resolve the problem.

                      Regards,

                      Qasim Khan