Hybrid View

  1. #1
    Ext User
    Join Date
    Apr 2010
    Posts
    1
    Vote Rating
    0
    brsanthu is on a distinguished road

      0  

    Default Unanswered: Grid not showing the data

    Unanswered: Grid not showing the data


    I did see many posts covering the same issue but unfortunately, I couldn't get the data displayed yet. Here is my code and json.

    Grid is coming up on the screen but it doesn't display the record.

    Any help is appreciated.

    Code:
    Code:
    <script>
    Ext.Loader.setConfig({enabled: true});
    Ext.require([
        'Ext.grid.*',
        'Ext.data.*',
        'Ext.toolbar.Paging'
    ]);
    
    
    Ext.define('User', {
        extend: 'Ext.data.Model',
        fields: [ {
      "name" : "id",
      "type" : "string"
    }, {
      "name" : "name",
      "type" : "string"
    }, {
      "name" : "email",
      "type" : "string"
    }, {
      "name" : "phone",
      "type" : "string"
    }, {
      "name" : "status",
      "type" : "string"
    } ],
        idProperty: 'id'
    });
    
    
    Ext.onReady(function(){
    
    
        Ext.QuickTips.init();
    
    
        // configure whether filter query is encoded or not (initially)
        var encode = false;
        
        var userStore = Ext.create('Ext.data.JsonStore', {
            // store configs
            autoDestroy: true,
            
            model: 'User',
            
            proxy: {
                type: 'ajax',
                url: 'Data?id=a09K0000002eB1K',
                reader: {
                    type: 'json',
                    root: 'data',
                    idProperty: 'id',
                    totalProperty: 'total'
                }
            },
            
            remoteSort: false,
            
            sorters: [{
                property: 'name',
                direction: 'ASC'
            }],
            
            pageSize: 100
        });
    
    
     var selModel = Ext.create('Ext.selection.CheckboxModel', {
         checkOnly: false // select from anywhere on row
     });
        
        var grid = Ext.create('Ext.grid.Panel', {
            border: true,
    
    
            store: userStore,
    
    
            columns: [ {
      "header" : "Id",
      "dataIndex" : "id",
      "sortable" : true,
      "hideable" : true,
      "draggable" : true,
      "groupable" : true
    }, {
      "header" : "Name",
      "dataIndex" : "name",
      "sortable" : true,
      "hideable" : true,
      "draggable" : true,
      "groupable" : true
    }, {
      "header" : "Email",
      "dataIndex" : "email",
      "sortable" : true,
      "hideable" : true,
      "draggable" : true,
      "groupable" : true
    }, {
      "header" : "Phone",
      "dataIndex" : "phone",
      "sortable" : true,
      "hideable" : true,
      "draggable" : true,
      "groupable" : true
    }, {
      "header" : "Status",
      "dataIndex" : "status",
      "sortable" : true,
      "hideable" : true,
      "draggable" : true,
      "groupable" : true
    } ],
    
    
            loadMask: true,
    
    
            multiSelect: true,
    
    
            dockedItems: [Ext.create('Ext.toolbar.Paging', {
                dock: 'bottom',
                store: userStore
            })],
            
            selModel: selModel,
            emptyText: 'There are no Users!',
      height: 600,
            title: 'Users',
            renderTo: 'report-grid',
            viewConfig: {
                stripeRows: true,
                enableTextSelection: true
            }    
        });
        
        userStore.load();
    });    
        </script>    
        <div id="report-grid"></div>
    </body></html>
    Data:
    Code:
     {  "total" : "1",  "data:" : [ {    "phone" : "(415) 222-3333",    "status" : "Registered",    "id" : "a0BK000000GLuD0MAL",    "email" : "john.smith@yopmail.com",    "name" : "john smith"  }]   }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,121
    Vote Rating
    453
    Answers
    3160
    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


    Have you checked the store to see if it has the data in it (haven't run your code)
    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.