Results 1 to 5 of 5

Thread: Data is not populated on Grid Panel

  1. #1
    Sencha User
    Join Date
    Dec 2016
    Posts
    12

    Default Answered: Data is not populated on Grid Panel

    Hi,

    I am creating a Panel and attaching a grid as an item to the Panel. The store is populated using memory proxy.
    The grid is attached to the div element comHistoryGrid.
    Here is the fiddle
    https://fiddle.sencha.com/#fiddle/1nj2&view/editor

    Code
    ====
    Ext.onReady(function(){
    Ext.define('comments', {
    extend: 'Ext.data.Model',
    fields: [
    {name: 'COMMENT', type: 'string'},
    {name: 'USERNAME', type: 'string'},
    {name: 'DATETIME', type: 'date'},
    {name: 'ID', type: 'string'}
    ]
    });
    var store = new Ext.data.Store({
    model: 'comments',
    data: [['I am in New York','sam.newyork','12-14-2016 16:44:37','2034'] ],
    autoLoad: true,
    proxy: {
    type: 'memory',
    reader: {
    type: 'json'
    }
    }
    });

    var grid = new Ext.grid.GridPanel({
    store: store,
    columns: [

    {header: "Comment", width:250, sortable: true, dataIndex: 'COMMENT',align:'left'},
    {header: "User Name", width:100, sortable: true, dataIndex : 'USERNAME',align:'left'},
    {header: "Comment Date", width:90, sortable: true, dataIndex: 'DATETIME',align:'center'}
    ],
    stripeRows: true,
    columnLines : true,
    autoExpandColumn: 'COMMENT',
    height: 150,
    width:'100%',
    viewConfig: {
    forceFit: true
    },
    frame:true,
    });


    var p = new Ext.Panel({
    title: 'Comment History',
    collapsible:false,
    renderTo: 'comHistoryGrid',
    autoWidth:true,
    items: [grid],
    layout: 'fit'
    });

    store.load({params:{start:0, limit:5}});
    });


    My Html code
    ===========
    <html>
    <head>
    </head>
    <body>
    <div id="comHistoryGrid"></div>
    </body>
    </html>

    What am I doing wrong?

    Kindly advice,
    Ana

  2. I think you need to either use a proxy or the store's 'data' config but not both. It works without the proxy and store.load. I would also recommend removing the outer panel since a grid panel is already a panel.
    https://fiddle.sencha.com/#fiddle/1nj5&view/editor

  3. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    I think you need to either use a proxy or the store's 'data' config but not both. It works without the proxy and store.load. I would also recommend removing the outer panel since a grid panel is already a panel.
    https://fiddle.sencha.com/#fiddle/1nj5&view/editor

  4. #3
    Sencha User
    Join Date
    Dec 2016
    Posts
    12

    Default

    Your solution worked. Thank you very much.

    Quick question : When is memory proxy used?

  5. #4
    Sencha User vick_44's Avatar
    Join Date
    Jul 2016
    Posts
    64
    Answers
    6

    Default

    Memory proxy is used when one needs to update the store (data in store) and keep it in memory until page refresh.

  6. #5
    Sencha User
    Join Date
    Dec 2016
    Posts
    12

    Default

    Thanks for the information

Similar Threads

  1. the list is not populated with data from server
    By lukesayaw in forum Sencha Touch 1.x: Discussion
    Replies: 14
    Last Post: 13 Oct 2010, 6:54 PM
  2. Not getting any error but the data is not getting populated into the jsp
    By Vijaya436 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 11 Nov 2009, 9:45 AM
  3. Multiselect box : data not populated
    By anilsonawane in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 20 Oct 2008, 1:07 AM
  4. Grid populated with data from various ajax calls
    By kgm in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 18 Jan 2008, 8:20 AM

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
  •