Results 1 to 4 of 4

Thread: [Solved] Trouble with Grid Paging and additional params

  1. #1

    Default [Solved] Trouble with Grid Paging and additional params

    Im using a php page which has all my queries based on a queryid that i pass to it. this is how i load the store the first time:
    Code:
     dsMovies.load({params:{start: 0, limit: 25, queryid: 201}});
    and this is my store:
    Code:
     var dsMovies = new Ext.data.JsonStore({
      totalProperty : 'total', 
      root   : 'results', 
      url    : 'php/myqueries.php',  
      fields   : [
       {name: 'movieid', type: 'int'},
       'moviename', 'moviegenre', 'movieyear', 'movieoutline', 'movieplot', 'movieimdbid', 'movieposter', 
       'moviedirector', 'movierating'
      ]
     });
    and this is the pagingtoolbar
    Code:
    var pbarMovies = new Ext.PagingToolbar({
     pageSize: 25,
     store: dsMovies,
     displayInfo: true,
     displayMsg: 'Displaying {0} - {1} of {2}',
     emptyMsg: "No Movies to display"
    });
    when the page loads, i can see from firebug that the posted params are:
    Code:
    limit 25
    queryid 201
    start 0
    but when i press the next button on the paging toolbar this the params that are sent (seen from firebug)
    Code:
    limit 25
    start 25
    and i get no results back? any thoughts?

  2. #2

    Default

    I reverted to the old way i had my queries setup, using the GET:
    Code:
     var dsMovies = new Ext.data.JsonStore({
      totalProperty : 'total', 
      root   : 'results', 
      url    : 'php/myqueries.php?queryid=201',  
      method   : 'post',
      fields   : [
       {name: 'movieid', type: 'int'},
       'moviename', 'moviegenre', 'movieyear', 'movieoutline', 'movieplot', 'movieimdbid', 'movieposter', 
       'moviedirector', 'movierating'
      ]
     });
    and if i need to change the queryid i use:
    Code:
    dsMovies.proxy.conn.url = 'php/myqueries.php?queryid=702';  
    dsMovies.load({params:{start: 0, limit: 25, var1: el.getValue()}});
    which works.. but i still would like to know how can i make it work using POST

  3. #3
    Sencha User carol.ext's Avatar
    Join Date
    Jun 2007
    Location
    Littleton, Colorado, USA
    Posts
    707

    Default

    Look at baseParams, setBaseParam() in JsonStore API

    See Grid FAQ section on sending additional data with baseParams. setBaseParam() is new to 3.0, I don't think it is mentioned in Grid FAQ.

  4. #4

    Default

    That is very funny I read about baseParams during my search and i already tried it earlier today, but for some reason it did not work but i thought now that you mentioned it, maybe i should give it another try.. and it worked
    Code:
    var dsMovies = new Ext.data.JsonStore({
      totalProperty : 'total', 
      root   : 'results', 
      url    : 'php/myqueries.php',  
      baseParams  : { queryid: 201},
      method   : 'post',
      fields   : [
       {name: 'movieid', type: 'int'},
       'moviename', 'moviegenre', 'movieyear', 'movieoutline', 'movieplot', 'movieimdbid', 'movieposter', 
       'moviedirector', 'movierating'
      ]
     });

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •