Results 1 to 4 of 4

Thread: load store with params

  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    81
    Answers
    2
    Vote Rating
    0
      0  

    Default load store with params

    hi, am new to ext 4. i want to load a store with params that can pass the start & limit of my query in database.php..... actually the code works in extjs 3 but not in extjs 4,
    here is my code
    var store = new Ext.data.JsonStore({
    totalProperty: 'total',
    root: 'results',
    url: 'database.php',
    fields: [
    {name: 'id', type: 'int'},
    'text', 'parent_id'
    ]
    });


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

    please...

  2. #2
    Sencha User
    Join Date
    Jun 2012
    Posts
    5
    Vote Rating
    0
      0  

    Default

    Code:
    store.getProxy().extraParams.start= 0;
    store.load();

  3. #3
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716
    Vote Rating
    505
      0  

    Default

    Your call should work fine.. what problem are you having? Does the header contain the info?

    Code:
    store.load(
    {
        params: {
            start: 0,
            limit: 25,
            sort: '[{"property":"id_request","direction":"DESC"}]' // defined in model as object
        }
    });
    Scott.

  4. #4
    Sencha User
    Join Date
    Jun 2012
    Posts
    81
    Answers
    2
    Vote Rating
    0
      0  

    Default 10ks to you all

    for sure it was a silly mistake but i figured it out and this my be helpfully for some one who is going to have a problem like me....here is the code


    var store=Ext.create('Ext.data.Store', {
    model: 'User',
    loadMask: true,
    //method: 'GET',
    pageSize: 10,
    proxy: {

    type: 'ajax',
    url : 'grid.php',

    reader: {
    type: 'json',
    root: 'results',
    totalProperty: 'total'
    },
    actionMethods:'POST' //
    }
    });

    var par = new Object();
    par['start'] = 0;
    par['limit']=10;
    store.load({params: par});

    and at the end of database.php you have to echo "out" the json out put like this.
    echo '({"total":"'.$totaldata.'","results":'.json_encode($data).'})';
    and this works fine,in extjs4

Posting Permissions

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