Results 1 to 2 of 2

Thread: Struts2 Ext-js Datagrid data rendering problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Struts2 Ext-js Datagrid data rendering problem

    Hello all,
    I am new to Ext-js and I am trying to make datagrid work with my struts application.

    Following is my javascript.
    Code:
    Ext.onReady(function(){
    	var store = new Ext.data.JsonStore({
    		url: 'testJson', 
    		fields: [ 
    			'id', 'firstName', 'lastName'
    		]
    	});
    	
    	store.load();
    	
    	var grid = new Ext.grid.GridPanel({
    		store : store,
    		columns : [
    		{header: 'id', width: 100, sortable: true, dataIndex: 'id'}, 
    		{header: 'firstName', width: 100, sortable: true, dataIndex: 'firstName'},
    		{header: 'lastName', width: 100, sortable: true, dataIndex: 'lastName'}
    		], 
    		stripeRows: true, 
    		height: 250, 
    		width: 500, 
    		title: 'DB grid'
    	});
    	grid.render('user');
    });
    Following is the code in my JSP page
    Code:
    <div id="user"></div>
    and the following is the JSON response
    Code:
    {"success":true,"users":[{"firstName":"James","id":"id1","lastName":"Dean"},{"firstName":"Brad","id":"id2","lastName":"Pitt"},{"firstName":"George","id":"id3","lastName":"Clooney"}]}
    It displays the grid with the header but it doesn't display any data...

    Could anyone tell me what is wrong with it? is it 'dataIndex'?

  2. #2

    Default

    Okay that was stupid on my part. I forgot to read "success" and root "users" duhh!

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
  •