Announcement

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

    Paging

    How exactly paging works? Does all records are fetched from server in one go and are cached on browser side?
    We have following scenario :

    we have more than 15000 records on server, server heap memory error occurs if we try to retrieve all the records at a time . Can paging help here ?

    What I mean is can we make smart client retrieve the data from server in chunks ? Or something like that.

    #2
    How pagination works using SmartClient6.5?

    Hi,

    How pagination works using SmartClient6.5?
    Please let me know along with a sample code of the same?

    Thanks..

    Comment


      #3
      If your server can use the startRow and endRow metadata sent using the RestDataSource to only choose certain rows to return and then include those same values along with totalRows in the response, you have everything necessary to perform paging. Then you can set dataPageSize on your data bound components to determine how many rows to request at a time.

      Comment


        #4
        Paging broken

        hi David ,
        I am using paging in same way but it is broken when I tried to use transformResponse to get some extra parameter in response .
        Can you suggest on that ??

        Comment


          #5
          Can you show your transformResponse code? You either have to call the parent transformResponse or move the startRow, endRow, totalRows to dsResponse from data.response yourself. Take a look at the RestDataSource.transformResponse source for steps you need to take.

          Comment


            #6
            transform response code

            Yeah David ,restdatasource and transform response code is as below : startRow ,endRows and totalRows are coming in response

            isc.RestDataSource.create({
            ID: "msgListdataSource",
            dataFormat: "xml",
            showPrompt: false,
            showPrompt: false,
            updateDataURL:"<%= request.getContextPath() %>/MsgCenterSmartClient/MsgCenterSmartClient_updateReadFlag.action",
            removeDataURL:"<%= request.getContextPath() %>/MsgCenterSmartClient/MsgCenterSmartClient_deleteMessage.action",
            fields: [
            {name: "messageid", type: "text", primaryKey: true},
            {name: "priority", type: "text"},
            {name: "category", type: "text"},
            {name: "type", type: "text"},
            {name: "subject", type: "text"},
            {name: "receiveddatestring", type: "text"},
            {name: "expirydate", type: "text"},
            {name: "smstext", type: "text"},
            {name: "attachmentnames", type: "text"},
            {name: "singleattachmentid", type: "text"},
            {name: "readflag", type: "text"},
            {name: "icon", type: "image"},
            {name: "expiryflag", type: "text"},
            {name: "todaysmsg", type: "text"}
            ],
            transformResponse : function (dsResponse, dsRequest, xmlData) {
            lastRecievdDate = '' + isc.XMLTools.selectString(xmlData, "/response/lastrecieveddate");
            if(lastRecievdDate == 'null') {
            lastRecievdDate = '' + isc.XMLTools.selectString(xmlData, "/response/data/record/lastrecieveddate");
            }
            msgListdataSource.fetchDataURL = "<%= request.getContextPath() %>/MsgCenterSmartClient/MsgCenterSmartClient_getMessages.action";
            }
            });
            Last edited by kapil2703; 8 Jul 2009, 04:51.

            Comment


              #7
              transformResponse handles moving the response from data.response to dsResponse. Your override does not do that and removes the RestDataSource.transformResponse code from the loop as well.

              See if this code for transformResponse works for you:
              Code:
              transformResponse : function (dsResponse, dsRequest, xmlData) {
                  dsResponse = this.Super("transformResponse", arguments);
              
                  lastRecievdDate = '' + isc.XMLTools.selectString(xmlData, "/response/lastrecieveddate");
                  if(lastRecievdDate == 'null') {
                      lastRecievdDate = '' + isc.XMLTools.selectString(xmlData, "/response/data/record/lastrecieveddate");
                  }
                  msgListdataSource.fetchDataURL = "<%= request.getContextPath() %>/MsgCenterSmartClient/MsgCenterSmartClient_getMessages.action";
              
                  return dsResponse;
              }

              Comment


                #8
                What is arguments??

                thnx David ..:)
                it works . I tried as below :

                var args = new Array(); args[0] = dsResponse; args[1] = dsRequest; args[2] = xmlData;
                dsResponse = this.Super("transformResponse",args);
                Last edited by kapil2703; 9 Jul 2009, 01:10.

                Comment


                  #9
                  Excellent. But you don't have to create an arguments array. Use the call exactly as provided and it will work. arguments is a built-in javascript variable sort of like this.

                  Comment

                  Working...
                  X