1. #1
    Sencha User
    Join Date
    Jul 2007
    Location
    Hungary
    Posts
    58
    Vote Rating
    0
    carstep is on a distinguished road

      0  

    Exclamation Grid example

    Grid example


    Hi Micha or all,

    I tried your code ot the example, that works fine. But if I try to use my code instead I never get the PagingToolbar to function properly. I always get a pagesize of 100, instead of 25, I had set just before.

    I post my js code here, and the json code, too

    If you or anybody has an idea what I am making wrong, don't let me unknown?

    thx
    Alex



    JS.code:

    Code:
    Ext.onReady(function(){
    var myPageSize = 25;
    
    var RecDef = Ext.data.Record.create([
    {name: 'id'},
    {name: 'intro'},
    {name: 'term'},
    {name: 'manuf'},
    {name: 'range'},
    {name: 'body'},
    {name: 'doors'},
    {name: 'cubic'},
    {name: 'gears'}
    ]);
    
    var ds = new Ext.data.Store({
    proxy: new Ext.data.HttpProxy({url:'http://localhost/configurator4glasses/getcar.php'}),
    reader: new Ext.data.JsonReader({
    root : 'cars',
    totalProperty: 'count',
    id: 'id'
    }, RecDef)
    });
    
    ds.setDefaultSort('id', 'ASC');
    
    var cm = new Ext.grid.ColumnModel([
    {header: 'ID', width: 20, dataIndex: 'id'},
    {header: 'Introduction', width: 80, dataIndex: 'intro'},
    {header: 'Termination', width: 80, dataIndex: 'term'},
    {header: 'Manufacturer', width: 100, dataIndex: 'manuf'},
    {header: 'Model', width: 90, dataIndex: 'range'},
    {header: 'Body', width: 50, dataIndex: 'body'},
    {header: 'Doors', width: 50, dataIndex: 'doors'},
    {header: 'cubic ', width: 40, dataIndex: 'cubic'},
    {header: 'Gears', width: 40, dataIndex: 'gears'}
    ]);
    
    cm.defaultSortable = true;
    
    var mainLayout = new Ext.BorderLayout(document.body,
    {
    center: {
    split:true
    },
    south: {
    split: true, initialSize:100
    }
    });
    
    mainLayout.beginUpdate();
    mainLayout.add('center', new Ext.ContentPanel('gridholder',{fitToFrame:true}));
    mainLayout.add('south', new Ext.ContentPanel('footer', {fitToFrame:true, closable: false}));
    mainLayout.endUpdate();
    
    var grid = new Ext.grid.Grid('grid1', {
    ds: ds,
    cm: cm
    });
    grid.render();
    
    var gridFoot = grid.getView().getFooterPanel(true);
    
    var paging = new Ext.PagingToolbar(
    gridFoot,
    ds,
    {
    pageSize: myPageSize,
    displayInfo: true,
    displayMsg: 'Displaying results {0} - {1} of {2}',
    emptyMsg: "No results to display"
    }
    );
    
    ds.load({params:{start:0, limit:myPageSize}});
    ds.reload();
    });
    Json code:

    {"count":200,"cars":[{"id":"14952","intro":"1990\/11","term":"1992","manuf":"Vauxhall","range":"Nova "

    ,"body":"Saloon","doors":"2","cubic":"993","gears" :"4 Speed"},{"id":"14952","intro":"1990\/11","term"

    :"1992","manuf":"Vauxhall","range":"Nova","body":" Saloon","doors":"4","cubic":"993","gears":"4 Speed"

    },{"id":"8378","intro":"1992\/02","term":"1993","manuf":"Vauxhall","range":"Nova ","body":"Saloon","doors"

    :"2","cubic":"1195","gears":"4 Speed"},{"id":"8378","intro":"1992\/02","term":"1993","manuf":"Vauxhall"

    ,"range":"Nova","body":"Saloon","doors":"4","cubic ":"1195","gears":"4 Speed"},{"id":"8379","intro":"1992

    \/02","term":"1993","manuf":"Vauxhall","range":"Nova ","body":"Hatchback","doors":"3","cubic":"1195","g ears"

    :"4 Speed"},{"id":"8379","intro":"1992\/02","term":"1993","manuf":"Vauxhall","range":"Nova ","body":"Hatchback"

    ,"doors":"5","cubic":"1195","gears":"4 Speed"},{"id":"14953","intro":"1990\/11","term":"1992","manuf"

  2. #2
    Ext User rodiniz's Avatar
    Join Date
    Mar 2007
    Location
    Rio de Janeiro, Brazil
    Posts
    276
    Vote Rating
    0
    rodiniz is on a distinguished road

      0  

    Default


    You have to show some of the server-side code since is there that you will create the json.

  3. #3
    Sencha User
    Join Date
    Jul 2007
    Location
    Hungary
    Posts
    58
    Vote Rating
    0
    carstep is on a distinguished road

      0  

    Default


    Hi,

    ok, meanwhile I experimented around and realized that since 155 item I send back in json it works well, more than that makes the whole pagetoolbar buggy. And I select in my sql 200 items, i had to change it.

    here is the code:
    PHP Code:
    $con mysql_connect('localhost''****''******') or die('couldn\'t connect to the local instance');
        
    mysql_select_db('configurator4glasses',$con) or die('the database couldn\'t be selected');
        
        
    $cars[] = array(
            
    'id'     => 0,
            
    'intro' => '',
            
    'term'    => '',
            
    'manuf'    => '',
            
    'range' => '',
            
    'body'    => '',
            
    'doors'    => 0,
            
    'cubic'    => 0,
            
    'gears'    => 0
       
    );
        
    $count 0;
        
        if (
    $res mysql_query($SQL_BASE1)) {
            
    $count mysql_num_rows($res);
            
    $cars null;
            while (
    $row mysql_fetch_array($res)) {
                
    $cars[] = array(
                    
    'id'     => $row[0],
                    
    'intro' => $row[1],
                    
    'term'    => $row[2],
                    
    'manuf'    => $row[3],
                    
    'range' => $row[4],
                    
    'body'    => $row[5],
                    
    'doors'    => $row[6],
                    
    'cubic'    => $row[7],
                    
    'gears'    => $row[8]
               );
            }
            
        }
        
        
    $dataout = array('count1' => $count,'cars' => $cars);
        
        echo 
    json_encode($dataout); 
    Bye
    Alex

  4. #4
    Sencha User
    Join Date
    Jul 2007
    Location
    Hungary
    Posts
    58
    Vote Rating
    0
    carstep is on a distinguished road

      0  

    Default


    Hi All,

    I did take a look for warious limit variations and realized that it always shows half of the incoming data. In the example I downloaded it works well even with 200 incoming records.

    Why, can anybody explain it?

    Bye Alex

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi