1. #1
    Sencha User
    Join Date
    Feb 2013
    Location
    NZ
    Posts
    66
    Answers
    5
    Vote Rating
    0
    mazhar.shaikh is on a distinguished road

      0  

    Default Answered: Grid panel not displaying any data, but displays correct number of rows as expected.

    Answered: Grid panel not displaying any data, but displays correct number of rows as expected.


    I can see correct number of rows in the Grid, but all appear as 0's. I can see store loading fine and web service response too. Dont know what I am missing here. Have tried everything possible, but in vain.

    here is my code:
    Controller class:
    Code:
    // Get the selected item first
    var grid = Ext.getCmp('selectPicklistGrid');
    var store = Ext.getStore('InProgressStatus');
    //store.removeAll();
    var selections = grid.getSelectionModel().getSelection();
    if (selections.length > 0){
        if (selections[0] !== 'undefined'){
            var record = selections[0];
            this.application.log('Picklist Id selected: ' + selections[0].data.id);
            store.proxy.url = PickList.globals.url + "Orders/InProgressUpdate/" + selections[0].data.id + '?filter=' + filter;
            console.log(store.proxy.url);
            store.load({
                scope : this,
                callback : function(records, operation, success){
                    if (records.length > 0){
                        console.log(records);
                       // this.setActiveRecord(records[0]);
                    }
                }
            });
        }
    }
    else{
        //TODO: no items selected
    }
    GRID PANEL CODE:
    Code:
    {
                                xtype: 'gridpanel',
                                height: 333,
                                width: 991,
                                title: 'My Grid Panel',
                                store: 'InProgressStatus',
                                viewConfig: {
    
    
                                },
                                columns: [
                                    {
                                        xtype: 'gridcolumn',
                                        dataIndex: 'title',
                                        text: 'Title'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        dataIndex: 'pickQty',
                                        text: 'PickQty'
                                    },
                                    {
                                        xtype: 'gridcolumn',
                                        dataIndex: 'updateStatus',
                                        text: 'UpdateStatus'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        dataIndex: 'backOrder',
                                        text: 'BackOrder'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        dataIndex: 'onHold',
                                        text: 'OnHold'
                                    },
                                    {
                                        xtype: 'gridcolumn',
                                        dataIndex: 'customerDetails',
                                        text: 'CustomerDetails'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        dataIndex: 'lineNo',
                                        text: 'LineNo'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        dataIndex: 'id',
                                        text: 'Id'
                                    },
                                    {
                                        xtype: 'gridcolumn',
                                        dataIndex: 'isbn',
                                        text: 'Isbn'
                                    },
                                    {
                                        xtype: 'gridcolumn',
                                        dataIndex: 'titleDescription',
                                        text: 'TitleDescription'
                                    },
                                    {
                                        xtype: 'gridcolumn',
                                        dataIndex: 'author',
                                        text: 'Author'
                                    },
                                    {
                                        xtype: 'gridcolumn',
                                        dataIndex: 'format',
                                        text: 'Format'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        dataIndex: 'quantity',
                                        text: 'Quantity'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        dataIndex: 'webOrderNumber',
                                        text: 'WebOrderNumber'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        dataIndex: 'webOrderLineNumber',
                                        text: 'WebOrderLineNumber'
                                    },
                                    {
                                        xtype: 'gridcolumn',
                                        dataIndex: 'floor',
                                        text: 'Floor'
                                    },
                                    {
                                        xtype: 'gridcolumn',
                                        dataIndex: 'category',
                                        text: 'Category'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        dataIndex: 'stockOnHand',
                                        text: 'StockOnHand'
                                    },
                                    {
                                        xtype: 'datecolumn',
                                        dataIndex: 'receiptDate',
                                        text: 'ReceiptDate'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        dataIndex: 'receiptQty',
                                        text: 'ReceiptQty'
                                    },
                                    {
                                        xtype: 'booleancolumn',
                                        dataIndex: 'isParked',
                                        text: 'IsParked'
                                    },
                                    {
                                        xtype: 'gridcolumn',
                                        dataIndex: 'picklistLineStatus',
                                        text: 'PicklistLineStatus'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        dataIndex: 'webOrderBranch',
                                        text: 'WebOrderBranch'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        dataIndex: 'webOrderWorkstation',
                                        text: 'WebOrderWorkstation'
                                    },
                                    {
                                        xtype: 'numbercolumn',
                                        dataIndex: 'headerId',
                                        text: 'HeaderId'
                                    }
                                ]
                            },
    STORE CODE:
    Code:
    Ext.define('PickList.store.InProgressStatus', {
        extend: 'Ext.data.Store',
    
    
        requires: [
            'PickList.model.Details'
        ],
    
    
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                storeId: 'MyStore7',
                model: 'PickList.model.Details',
                proxy: {
                    type: 'rest',
                    headers: {
                        Accept: 'application/json',
                        'Content-Type': 'application/json'
                    },
                    reader: {
                        type: 'json',
                        idProperty: 'picklistId',
                        root: 'lines'
                    }
                }
            }, cfg)]);
        }
    });
    Model Code:
    Code:
    Ext.define('PickList.model.Details', {
        extend: 'Ext.data.Model',
    
    
        fields: [
            {
                name: 'title',
                type: 'string'
            },
            {
                name: 'pickQty',
                type: 'int'
            },
            {
                name: 'updateStatus',
                type: 'string'
            },
            {
                name: 'backOrder',
                type: 'int'
            },
            {
                name: 'onHold',
                type: 'int'
            },
            {
                name: 'customerDetails',
                type: 'string'
            },
            {
                name: 'lineNo',
                type: 'int'
            },
            {
                name: 'id',
                type: 'int'
            },
            {
                name: 'isbn',
                type: 'string'
            },
            {
                name: 'titleDescription',
                type: 'string'
            },
            {
                name: 'author',
                type: 'string'
            },
            {
                name: 'format',
                type: 'string'
            },
            {
                name: 'quantity',
                type: 'int'
            },
            {
                name: 'webOrderNumber',
                type: 'int'
            },
            {
                name: 'webOrderLineNumber',
                type: 'int'
            },
            {
                name: 'floor',
                type: 'string'
            },
            {
                name: 'category',
                type: 'string'
            },
            {
                name: 'stockOnHand',
                type: 'int'
            },
            {
                name: 'receiptDate',
                type: 'date'
            },
            {
                name: 'receiptQty',
                type: 'int'
            },
            {
                name: 'isParked',
                type: 'boolean'
            },
            {
                name: 'picklistLineStatus',
                type: 'string'
            },
            {
                name: 'webOrderBranch',
                type: 'int'
            },
            {
                name: 'webOrderWorkstation',
                type: 'int'
            },
            {
                name: 'headerId',
                type: 'int'
            }
        ]
    });
    Web service Response:

    Code:
    {"picklistId":5,"lines":
    [{"Title":"ISPEAK FRENCH WITH CD","PickedQuantity":0,"WebOrderStatus":"InProgress","BackOrderQuantity":0,"OnHoldQuantity":0,"CustomerDetailString":null,"LineNumber":5,"Id":110,"Isbn":"9780071486088","TitleDescription":null,"Author":"CHAPIN A","Format":"PaperBack","Quantity":-1,"WebOrderNumber":3000003,"WebOrderLine":0,"Floor":null,"Category":"LAN","StockOnHand":0,"LastReceiptDate":"0001-01-01T00:00:00","ReceiptQty":0,"IsParked":false,"PicklistLineStatus":"NotPicked","WebOrderBranch":0,"WebOrderWorkstation":0,"HeaderId":5},
    
    {"Title":"SHORTCUTS FOR STUDENT WRITERS","PickedQuantity":0,"WebOrderStatus":"InProgress","BackOrderQuantity":0,"OnHoldQuantity":0,"CustomerDetailString":null,"LineNumber":4,"Id":109,"Isbn":"9780071448468","TitleDescription":null,"Author":"SILVERMAN J","Format":"PaperBack","Quantity":1,"WebOrderNumber":6000046,"WebOrderLine":0,"Floor":null,"Category":"REF","StockOnHand":0,"LastReceiptDate":"0001-01-01T00:00:00","ReceiptQty":0,"IsParked":false,"PicklistLineStatus":"NotPicked","WebOrderBranch":0,"WebOrderWorkstation":0,"HeaderId":5},
    
    {"Title":"GRAND DESIGNS HANDBOOK BLUEPRINT FOR BUI","PickedQuantity":0,"WebOrderStatus":"InProgress","BackOrderQuantity":0,"OnHoldQuantity":0,"CustomerDetailString":null,"LineNumber":3,"Id":108,"Isbn":"9780007307425","TitleDescription":null,"Author":"MCCLOUD K","Format":"PaperBack","Quantity":-1,"WebOrderNumber":6000029,"WebOrderLine":0,"Floor":null,"Category":"HOM","StockOnHand":0,"LastReceiptDate":"0001-01-01T00:00:00","ReceiptQty":0,"IsParked":false,"PicklistLineStatus":"NotPicked","WebOrderBranch":0,"WebOrderWorkstation":0,"HeaderId":5},
    
    {"Title":"CHRONICLES OF NARNIA BOX SET FTI","PickedQuantity":0,"WebOrderStatus":"InProgress","BackOrderQuantity":0,"OnHoldQuantity":0,"CustomerDetailString":null,"LineNumber":2,"Id":107,"Isbn":"9780007258499","TitleDescription":null,"Author":"LEWIS C S","Format":"HardCover","Quantity":1,"WebOrderNumber":6000030,"WebOrderLine":0,"Floor":null,"Category":"CHC","StockOnHand":0,"LastReceiptDate":"0001-01-01T00:00:00","ReceiptQty":0,"IsParked":false,"PicklistLineStatus":"NotPicked","WebOrderBranch":0,"WebOrderWorkstation":0,"HeaderId":5},
    
    {"Title":"TIGER WHO CAME TO TEA","PickedQuantity":0,"WebOrderStatus":"InProgress","BackOrderQuantity":0,"OnHoldQuantity":0,"CustomerDetailString":null,"LineNumber":1,"Id":106,"Isbn":"9780007215997","TitleDescription":null,"Author":"KERR JUDITH","Format":"PaperBack","Quantity":-1,"WebOrderNumber":6000033,"WebOrderLine":0,"Floor":null,"Category":"CHP","StockOnHand":0,"LastReceiptDate":"0001-01-01T00:00:00","ReceiptQty":0,"IsParked":false,"PicklistLineStatus":"NotPicked","WebOrderBranch":0,"WebOrderWorkstation":0,"HeaderId":5}]}

  2. Your cases don't match, 'Title' is not the same as 'title'. The JSON, model field and dataIndex must all match. The text on the column is irrelevant.

    One way to fix it would be:

    Code:
    fields: [
        {
            name: 'title',
            mapping: 'Title',
            type: 'string'
        },
        ...

  3. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,590
    Answers
    541
    Vote Rating
    322
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      1  

    Default


    Your cases don't match, 'Title' is not the same as 'title'. The JSON, model field and dataIndex must all match. The text on the column is irrelevant.

    One way to fix it would be:

    Code:
    fields: [
        {
            name: 'title',
            mapping: 'Title',
            type: 'string'
        },
        ...

  4. #3
    Sencha User
    Join Date
    Feb 2013
    Location
    NZ
    Posts
    66
    Answers
    5
    Vote Rating
    0
    mazhar.shaikh is on a distinguished road

      0  

    Default Solved.

    Solved.


    You are a legend man..Thanks for the workaround..

    I dont generally use the
    mapping
    config, because I do the mapping in my C# code, like this:
    Code:
     [DataMember(Name = "title")]
            public string Title { get; set; }
    And I had done the same for this one too, but wonder why it isnt working.
    Anyway I will figure that out. But for time being your workaround is awesome.

    Thanks Mate

Thread Participants: 1

Tags for this Thread

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