1. #1
    Sencha User
    Join Date
    Nov 2007
    Posts
    34
    Vote Rating
    0
    flyzb is on a distinguished road

      0  

    Default ExtJs4 autogrid solution

    ExtJs4 autogrid solution


    here my solution,it works fine.

    my.json
    PHP Code:
    {"success":true,
     
    "metaData": { 
     
    "fields" :[
       {
    "name":"id","dataIndex":"id"},
       {
    "name":"user_id","dataIndex":"user_id"}
     ],
     
    "columns": [
       {
    "text""ID","dataIndex"'id'},
       {
    "text""user_id","dataIndex""user_id"}
     ] 
     },
    "data":[
        { 
    "id"1"user_id":"dasdfas"    },
        { 
    "id"2"user_id":"d3333333"    }
    ]} 
    autogrid.js
    PHP Code:
    Ext.require(['Ext.data.*''Ext.grid.*']);

    Ext.define('Order', {
        
    extend'Ext.data.Model',
        
    fields: []
    });

    Ext.onReady(function(){
        var 
    store = new Ext.data.Store({
            
    model"Order"
        
    });
        
        
        var 
    store Ext.create('Ext.data.JsonStore', {
            
    model'Order',
            
    proxy: {
                
    type'rest',
                
    url'my.json',
                
    reader: {
                    
    type'json',
                    
    root'data'
                
    }
            }
        });  
        
    store.load({
            
    callback: function() {
                var 
    columns=[];
                var 
    data=store.getProxy().getReader().rawData;
                if (
    data.metaData) {
                     
    columns data.metaData.columns;                 
                }
                var 
    grid Ext.create('Ext.grid.Panel', {
                    
    id:'usergrid',
                    
    renderTodocument.body
                    
    width400,
                    
    height300,
                    
    frametrue,
                    
    title'Users',
                    
    store: new Ext.data.Store({
                        
    model:"Order"
                    
    }),
                    
    iconCls'icon-user',
                    
    columnscolumns
                
    });    
                 var 
    jsonData=data.data;
                 var 
    i=0;
                 for(
    i=0;i<jsonData.length;i++){
                       
    Ext.getCmp('usergrid').getStore().add(jsonData[i]);
                 } 
                }
        });
        
    store.load();    
    }); 
    html
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <
    html>
    <
    head>
        <
    meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <
    title>Stateful Array Grid Example</title>
        <
    link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
        <
    link rel="stylesheet" type="text/css" href="../shared/example.css" />
        <
    script type="text/javascript" src="../../bootstrap.js"></script>
    <script type="text/javascript" src="autogrid.js"></script>

    </head>
    <body>
       
        
    </body>
    </html> 
    Last edited by flyzb; 5 Jun 2011 at 7:31 AM. Reason: solved

  2. #2
    Sencha User
    Join Date
    Nov 2007
    Posts
    34
    Vote Rating
    0
    flyzb is on a distinguished road

      0  

    Default


    I have solved the problem. the autogrid works fine.

  3. #3
    Sencha User
    Join Date
    May 2011
    Posts
    5
    Vote Rating
    -1
    panega is an unknown quantity at this point

      -1  

    Question help me guys....

    help me guys....


    hei you, how to implement extjs 4 with PHP and mysql...

    anyone can help me.... simple code....

    thanks..

  4. #4
    Sencha Premium Member
    Join Date
    Jul 2007
    Posts
    256
    Vote Rating
    1
    brookd is on a distinguished road

      0  

    Default Realtime reconfigure

    Realtime reconfigure


    What about if you want to change the columns without re-creating the grid?

  5. #5
    Sencha User
    Join Date
    Feb 2011
    Posts
    1
    Vote Rating
    0
    josh_bassplayer is on a distinguished road

      0  

    Default


    excellent work ....

  6. #6
    Sencha User
    Join Date
    Feb 2010
    Posts
    1
    Vote Rating
    0
    dotcompany is on a distinguished road

      0  

    Default


    how do paging in this sample?

  7. #7
    Sencha User
    Join Date
    Dec 2013
    Posts
    1
    Vote Rating
    0
    ICTsai is on a distinguished road

      0  

    Default


    works fine!!thanks youbut I have a questionin
    json"fields" :[ {"name":"id","dataIndex":"id"}, {"name":"user_id","dataIndex":"user_id"} ],
    it seem not used
    right?

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar