NNKL.COM
welcome to my space
X
Search:  
 HOME   Problem displaying JSON data in GridPanel
Problem displaying JSON data in GridPanel
Published by: jack 2010-03-16
Welcome to:nnkl.com

  • Hi all,

    After many tries and help from the grid examples in this forum, I almost have my grid working. I'm successfully returning JSON data, but it doesn't get displayed in the Grid. I only have a grid header and the buttons at the bottom. If I View Generated Source, I see the rows of data. Also, if I check the checkbox in my grid header, my onclick function (showChecked, see code sample) displays the row IDs as expected. I would greatly appreciate some help to get the grid to display. Here's my code:
    Appirio Tech Blog::
    Things become tricky when one needs to display data from more than one object in a table. To solve this problem one need only define a dummy class to hold
    http://www.appirio.com/techblog/labels/Visualforce.php
    HOME
    OTN Discussion Forums : Extjs - Very Simple Example ::
    14 posts - 5 authors - Last post: Oct 24, 2007No, nothing with JSON or anything yetjust a simple loading mask. . Does anyone know how to display #workspace_images# without it doing
    http://kr.forums.oracle.com/forums/thread.jspa?threadID=569377
    HOME

    blog@ongmap.com » Tutorial: How to use Google Maps API with Ext.JS::
    Displaying a loading message is a good idea because loading Google Maps .. TreeLoader requires the dataUrl (handler.php) to return the data in JSON
    http://ongmap.com/blog/?page_id=259
    HOME

    var PurgeUI = function() {

    var ds;
    var cm;
    var sm;
    var grid;

    var showChecked = function() {
    var m = grid.getSelections();
    var len = m.length;
    var msg;
    if (len == 0) {
    msg = "Nothing has been selected";
    } else {
    msg = "You Selected:";
    for(var i = 0; i < len; i++) {
    msg += "
    " + m[i].data.alloc_id;
    }
    }
    Ext.MessageBox.alert("Message", msg);
    };


    function setupDataSource() {
    ds = new Ext.data.Store({
    proxy: new Ext.data.HttpProxy({
    url: purge_url + '?program=PurgeContrib&userid=' + Ext.get('userid').dom.value + '&screen=listData',
    method: 'GET'
    }),
    reader: new Ext.data.JsonReader({
    root: 'purge',
    id: 'alloc_id'
    },[
    {name: 'alloc_id', type: 'int'},
    {name: 'alloc_amt', type: 'float'},
    jeefspace.com | First Ext JS Tutorial: Grid Layout::
    Jun 8, 2008 I am going to learn how to build a grid to display data using the The store option is required for the grid panel, so I reckon I should
    http://jeefspace.com/blog/2008/06/08/first-ext-js-tutorial-grid-layout/
    HOME
    请教:json串中读取属性对应值问题- EXT - AJAX - JavaEye论坛::
    注意:即使不成功,也需要返回Ext.data.JsonReader里定义的全部字段,留空即可,否则JSON无法读出'success'字段。 详情可以参考这里:
    http://www.javaeye.com/topic/132880
    HOME
    {name: 'contract_num'},
    {name: 'receive_date'}
    ])
    });

    ds.load();
    }

    function getColumnModel() {
    sm = new Ext.grid.CheckboxSelectionModel();
    cm = new Ext.grid.ColumnModel([
    sm,
    {
    header: 'Contract Num',
    dataIndex: 'contract_num',
    width: 150,
    sortable: true
    },{
    header: 'Alloc ID',
    dataIndex: 'alloc_id',
    width: 75,
    sortable: true
    },{
    header: 'Processed Date',
    width: 225,
    dataIndex: 'receive_date',
    sortable: true
    },{
    header: 'Amount',
    width: 150,
    dataIndex: 'alloc_amt',
    sortable: true,
    renderer: Ext.util.Format.usMoney
    }
    ]);
    return cm;
    }

    function buildGrid() {
    grid = new Ext.grid.GridPanel({
    ds: ds,
    cm: getColumnModel(),
    sm: sm,
    viewConfig: {
    forceFit:true
    },
    buttons: [{
    text:'Update',
    listeners: {click: showChecked}
    },{
    text:'Cancel'
    }],
    buttonAlign:'center',
    width:850,
    frame:true,
    title:'Contribution Purge',
    iconCls:'icon-grid',
    renderTo: 'purge'
    });

    }

    return {
    init: function() {
    setupDataSource();
    buildGrid();
    },

    getDataSource: function() {
    return ds;
    }
    }
    }();

    Ext.onReady(PurgeUI.init, PurgeUI, true);


    Thanks very much,
    Jim


  • 'purge' is a form id and it does not have a height set.


  • The empty div will have a size of zero. The Grid needs to know how high you want it to be so that it can create the viewable area in whcih to scroll the large, possibly overflowing set of rows.


  • Is 'purge' a div? Does it have a height set?


  • Is 'purge' a div? Does it have a height set?
    Tim, thanks much for pointing me in the right direction. Problem solved. I added a height to the GridPanel and now I can see the data.
    width:850,
    height:450,
    frame:true,

    Just so I can understand this better, why did I need a 'height' set for this to work, but when I created a variable within my javascript to hold my JSON data during testing, it displayed correctly without a height being set? It seems to dynamically adjust the height to however many rows I'm returning.

    Thanks again - Jim





  • Get Smart About Monitoring Virtual Machines
    Microsoft Gets Ex-Streamly Cozy with U.K.'s MediaWave

    You are looking at:nnkl.com's Problem displaying JSON data in GridPanel, click nnkl.com to home
  • why isn 039 t my laptop charger working
  • can you download ubuntu onto a dell latitude c640
  • my laptops mouse thing is messed up
  • what are some cheap pc laptops that play city of heroes
  • does anybody know where i can buy the cheapest new laptop
  • is the hp pavilion dv2990nr any good
  • why won 039 t my laptop read dvd 039 s
  • isn 039 t wireless technology potentially insecure
  • where can i find a good laptop for a reasoanble price
  • how can i make bia hells highway work on my laptop
  • is it bad to use a laptop when it says the battery needs to be replaced
  • why is my vista laptop not starting up
  • can i leave my laptop upside down
  • compaq presario cq50z series vs dell inspiron 1525
  •  
  • laptop for video editing
  • my laptop 039 s keyboard doesn 039 t work
  • how do i setup a network from laptop to laptop to transfer files
  • hp laptop that turns into a wacom like tablet
  • my roommate locked me out of my lap top with a administrative password on my toshiba laptop how can i reset it
  • the screen on my laptop ed please help me
  • what are some cheap pcs laptops that play city of heroes name some pcs
  • what is more important faster cpu cache or more ram
  • help with my dell inspiron 1525
  • how to transfer data fr laptop to laptop
  • sony vaio laptop sound problems
  • i have an dell inspiron b130 notebook my battery is empty and my power source wont charge it at all
  • is this laptop ok for vista ultimate upgrade
  •  Homepage | Add to favorites | Contact us | Exchange links | LOGIN | Site map | 
    Copyright© 2008 nnkl.com        Site made:CFZ