1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    10
    Vote Rating
    0
    nizhelya is on a distinguished road

      0  

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

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,121
    Vote Rating
    453
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  3. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    10
    Vote Rating
    0
    nizhelya is on a distinguished road

      0  

    Default


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

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,121
    Vote Rating
    453
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    If you are doing paging then on the server
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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