Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Pagination Loop with livegrid

    SmartGWT 2.3 , 2.4 or 2.5 (All browsers)

    Hi!
    Trying to implement live pagination with LiveGrid, we get a loop of requests asking always the same set of results to the server, something like this:

    2011-09-01 12:36:38,937 [DEBUG] MediatecaSmart_TEST.java:87 - Response info:
    2011-09-01 12:36:38,952 [DEBUG] MediatecaSmart_TEST.java:88 - Rows: [0, 50] of 100
    2011-09-01 12:36:38,952 [DEBUG] MediatecaSmart_TEST.java:89 - Status: 0
    2011-09-01 12:36:39,374 [DEBUG] MediatecaSmart_TEST.java:87 - Response info:
    2011-09-01 12:36:39,374 [DEBUG] MediatecaSmart_TEST.java:88 - Rows: [0, 50] of 100
    2011-09-01 12:36:39,390 [DEBUG] MediatecaSmart_TEST.java:89 - Status: 0
    2011-09-01 12:36:39,812 [DEBUG] MediatecaSmart_TEST.java:87 - Response info:
    2011-09-01 12:36:39,827 [DEBUG] MediatecaSmart_TEST.java:88 - Rows: [0, 50] of 100
    2011-09-01 12:36:39,827 [DEBUG] MediatecaSmart_TEST.java:89 - Status: 0
    2011-09-01 12:36:40,249 [DEBUG] MediatecaSmart_TEST.java:87 - Response info:
    2011-09-01 12:36:40,249 [DEBUG] MediatecaSmart_TEST.java:88 - Rows: [0, 50] of 100
    2011-09-01 12:36:40,265 [DEBUG] MediatecaSmart_TEST.java:89 - Status: 0

    I've attached the code and datasource.
    Are we missing something?
    Thanks in advcance.
    Attached Files

    #2
    You probably are not returning correct startRow/endRow/totalRows values in your responses. Use the RPC tab in the Developer Console to see the requests and responses.

    Comment


      #3
      Thanks Iso,
      We believe we are passing the parameters right.
      Could it be the xml datasource? Look at that awful namespace for record tag:

      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
      <response>
      <status>0</status>
      <startRow>0</startRow>
      <endRow>10</endRow>
      <totalRows>100</totalRows>
      <data>
      <record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="sysObjectRecord">
      <id>799</id>
      <name>doc 0</name>

      etc...
      What do you think?
      Thanks and regards.

      Comment


        #4
        Given that that's not valid XML (xsi prefix used without first declaring it), yes that's the problem - this is also clearly reported in the console.

        Comment


          #5
          Hi Isomorphic,

          I don't know much about XML but, isn't "xsi" prefix declared by the expression xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ?
          That's what I suppose and what is said here: http://www.coderanch.com/t/128053/XM...xmlns-xsi-mean

          That XML was generated by JAXB. Do you think JAXB generates invalid XML?

          Thank you very much.

          Ferran
          Last edited by ferranmc; 5 Sep 2011, 00:42.

          Comment


            #6
            By the way, the live grid works with this XML. Here the "xsi" prefix is in the "value" tag.

            Code:
            <documentSearchResult totalRows="21" endRow="10" startRow="0">
              <objects>
                <object>
                  <id>09019938800a70f4</id>
                  <name>doc3</name>
                  <type>m_revista</type>
                  <properties>
                    <entry>
                      <key>r_object_type</key>
                      <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">m_revista</value>
                    </entry>
            ...
            I think the problem are the attributes/namespaces in the "record path". Here the record path is "/documentSearchResult/objects/object". In my opinion this XML works because the record tag "object" doesn't have attributes/namespaces.

            Thanks for your help.

            Ferran
            Last edited by ferranmc; 5 Sep 2011, 03:08.

            Comment


              #7
              Sorry, it's correct XML because the prefix is declared inline. However this puts the element in a different namespace, meaning the xpath used to select it has to have a matching namespace.

              For simplicity, you should probably see if you can just avoid JAXB namespacing that element. Otherwise, you have Googling to learn about xpath and XML namespaces.

              Comment


                #8
                I think SmartGWT has a bug here because if you have this XML:

                Code:
                <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
                <response>
                  <status>0</status>
                  <startRow>0</startRow>
                  <endRow>10</endRow>
                  <totalRows>100</totalRows>
                  <data>
                    <record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="sysObjectRecord">
                      <id>1</id>
                      <name>doc 1</name>
                    </record>
                    <record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="sysObjectRecord">
                      <id>2</id>
                      <name>doc 2</name>
                    </record>
                  </data>
                </response>
                then the XPath "/response/data/record" should be a valid record XPath for a DataSource. You can try it here: http://www.mizar.dk/XPath/Default.aspx

                We don't need to include namespace information in the XPath as you say. Don't you think?

                Regards,

                Ferran

                Comment

                Working...
                X