1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    0
    noncom is on a distinguished road

      0  

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

    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 Premium Member
    Join Date
    Dec 2009
    Location
    Iasi, Romania
    Posts
    89
    Answers
    2
    Vote Rating
    14
    ateodorescu will become famous soon enough

      0  

    Default


    Hi,

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

    Cheers
    https://github.com/ateodorescu/mzExt
    http://www.mzsolutions.eu/

    Mz.pivot.Grid
    Ext.ux.form.plugin.HtmlEditor
    Ext.ux.form.field.CodeMirror
    Ext.ux.form.field.ImageFileField
    Ext.ux.form.field.UploadFileField

  4. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    13
    Vote Rating
    0
    noncom is on a distinguished road

      0  

    Default


    Thank you so much! That worked!!!

Thread Participants: 1

Tags for this Thread