Results 1 to 4 of 4

Thread: Ext.Direct and Grid with Paging Toolbar (Need Help!)

  1. #1
    Sencha Premium Member
    Join Date
    Jan 2012
    Posts
    10
    Vote Rating
    0
      0  

    Default Ext.Direct and Grid with Paging Toolbar (Need Help!)

    I'm learning tutorial (Mapping a Grid to a MySQL table using Direct and PHP Part 2) and trying to connect a Paging Toolbar to a Grid. But using the following QueryDatabase.php function I get all 1000 records from Database (it is a PhP code from zip provided by Sencha for that tutorial):
    PHP Code:
    public function getResults(stdClass $params)
        {
            
            
    $_db $this->__construct();
       
            
    $_result $_db->query('SELECT id, name, address, state FROM owners');
            
            
    $results = array();
           
            while (
    $row $_result->fetch_assoc()) {
                
    array_push($results$row);
            }
            
            return 
    $results;
        } 
    Click on Paging Toolbar Next Page button sends data with the following parameters to server: {"action":"QueryDatabase","method":"getResults","data":[{"page":3,"start":50,"limit":25}],"type":"rpc","tid":3}

    But this function does not process(provide) those parameters.

    I can remake PhP code and make it process the Query using "start" and "limit" post variables in SQL query. Also I can get a total table records amount ($total). But I need to send $total to Reader (through return function array $results).

    How I can do that?
    Is there any working solution for this function where all params included (sort, filter, total) ?

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,320
    Vote Rating
    1293
      0  

    Default

    This would be up to your implementation. It would be as easy as checking for a param in the request and adding the needed SQL bits to the query.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member
    Join Date
    Jan 2012
    Posts
    10
    Vote Rating
    0
      0  

    Default

    Thanks. Where is better to do sorting: in SQL query or in grid?

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,320
    Vote Rating
    1293
      0  

    Default

    If you are doing paging then on the server
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Tags for this Thread

Posting Permissions

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