1. #1
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    315
    Vote Rating
    0
    josh803316 is on a distinguished road

      0  

    Default [SOLVED]Paging Memory Proxy + SoapProxy + Grid Paging Help

    [SOLVED]Paging Memory Proxy + SoapProxy + Grid Paging Help


    So my app is talking to a soap server that returns all values for a given call (server doesn't limit results). I want to use the paging memory proxy so that I can load all results into memory and then present the paged grid to the user based on page size settings. It seems that all the results are retrieved (pagingbar message says showing 1-5 of 17 with 4 pages) and that my array slice works since I only see the limit amount of 5, but when I hit the pager next button a call to the server is again made, instead of paging from memory and the same first 5 values are displayed.

    I can currently limit the size of the intitial grid by setting my params as follows:
    (This is passed to the SoapProxy and stored as the proxy in the json reader)
    Code:
    var o = {
      url : "/test.wsdl",
      method : "sGetAll",
      namespace: "test",
      disableCaching: false,
      params : {
      	  sReq: "subscriber",
          tag : "subscriber",
          start: 0,
          limit: 5
      }
    };
    var proxy = new Ext.ux.soap.SoapProxy(o);
    This is the loadResponse inside the SoapProxy extension
    Code:
    loadResponse : function(options, success, response) {     	
            delete this.activeRequest;
            if(!success){
                this.fireEvent("loadexception", this, options, response);
                this.callback.call(this.scope, null, this.arg, false);
                return;
            }
            var result;
            try {
                result = this.reader.read(Ext.ux.soap.getXML(response), this.url, this.method);  //reader needs also url and methodName
                console.dir(result);
            }catch(e){
                this.fireEvent("loadexception", this, options, response, e);
                this.callback.call(this.scope, null, this.arg, false);
                return;
            }
            this.fireEvent("load", this, options, this.arg);
          
            // paging (use undefined cause start can also be 0 (thus false))
    	if (this.params.start!==undefined && this.params.limit!==undefined) {		
    	  result.records = result.records.slice(this.params.start, this.params.start+this.params.limit);		
    	}
            this.callback.call(this.scope, result, this.arg, true);
        },
    In the Grid extension:
    Code:
    this.bbar = new Ext.PagingToolbar({
    					 store:this.store
    					 ,displayInfo:true
    					 ,pageSize:5
    		 		 });
    Last edited by josh803316; 21 Feb 2009 at 11:49 AM. Reason: SOLVED

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    91
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Why not use my PagingStore instead of a PagingMemoryProxy? That would save you a lot of coding!

  3. #3
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    315
    Vote Rating
    0
    josh803316 is on a distinguished road

      0  

    Default


    Condor, I have been playing around with that solution as well but as yet can't get it to work quite right.

    I changed my app json store to use the JsonPaginStore but now I don't see any results. Are there any gotchas I need to know about?

    Code:
    Ext.extend(app.JsonStore, Ext.ux.data.JsonPagingStore);

  4. #4
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    315
    Vote Rating
    0
    josh803316 is on a distinguished road

      0  

    Default


    Condor, thanks to your suggestion I am almost there. Last problem is that I'm seeing the entire return in the first page of the grid, but then when I page it works properly according to page size. Where do I need to set my limit? I tried last options in my store config but that didn't seem to change anything.

    I had to change to this to get it to load the grid properly.
    Code:
    Ext.extend(app.DataStore, Ext.ux.data.PagingStore);

  5. #5
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    315
    Vote Rating
    0
    josh803316 is on a distinguished road

      0  

    Default


    Nevermind, I got that working as well had to define the params on load:

    paging_store.load({params:{start:0, limit:5}});

Thread Participants: 1