Results 1 to 3 of 3

Thread: Simple Grid does not get filled with data..

  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    0
      0  

    Default Answered: Simple Grid does not get filled with data..

    I have the following code on my page. The grid is displayed ok with the names of the columns, but the data is missing. The real records amount is truncated not to waste the space on this forum:

    Code:
    <script type="text/javascript">
    
    
    Ext.onReady(function() {
    
    
        Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));
    
    
        Ext.define('model_grid', {
            extend: 'Ext.data.Model',
            fields: [
                {
                    convert: null,
                    defaultValue: undefined
                },{
                    type: 'string',
                    convert: null,
                    defaultValue: undefined
                },{
                    type: 'string',
                    convert: null,
                    defaultValue: undefined
                },{
                    type: 'string',
                    convert: null,
                    defaultValue: undefined
                },{
                    type: 'bool',
                    convert: null,
                    defaultValue: undefined
                }
            ]
        });
    
    
        var data_grid = [
            ['John', 'id-AA1', 'worker', 'super departament', true],
            ['Bob', 'id-CCA', 'sub-worker', 'departament of kki', true],
            ['Smith', 'id-AA2, 'manager', 'departament of kki', false]
        ];
    
    
        var store = Ext.create('Ext.data.ArrayStore', {
            data: data_grid,
            model: 'model_grid'
        });
    
    
        /*
        * ========== comment ==========
         */
    
    
        var var_grid = Ext.widget({
            columns: [
                {
                    text: 'Name',
                    sortable: true,
                    flex: 1,
                    dataIndex: 'name',
                    width: 200
                },{
                    text: 'Card',
                    sortable: false,
                    width: 75
                },{
                    text: 'Position',
                    sortable: true,
                    dataIndex: 'position',
                    width: 100
                },{
                    text: 'Departament',
                    sortable: true,
                    dataIndex: 'pctChange',
                    width: 100
                },{
                    text: 'Employed',
                    sortable: false,
                    width: 50
                }
            ],
            store: store,
            name: 'grid',
            xtype: 'gridpanel'
        });
    
    
        var_grid.render(document.body);
    });
    
    
    </script>
    Why does not data go into the table?

  2. Hi,

    You used "dataIndex" on your column definitions but your model fields have no "name". Remove "convert" configs and add names.

    Cheers

  3. #2
    Sencha - Ext JS Dev Team
    Join Date
    Dec 2009
    Location
    Iasi, Romania
    Posts
    117
    Answers
    7
    Vote Rating
    22
      0  

    Default

    Hi,

    You used "dataIndex" on your column definitions but your model fields have no "name". Remove "convert" configs and add names.

    Cheers

  4. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    0
      0  

    Default

    Thank you so much! That worked!!!

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
  •