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.phpHOME | 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=569377HOME |
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=259HOME |
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/132880HOME |
{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
|