PDA

View Full Version : Dynamic grid without data



webtime
8 May 2010, 6:51 AM
Hi,
with this code i'd view my table data but i see only grid headers....




Ext.onReady(function(){

Pgridaction = document.forms[0].gridAction.value;
Paction = document.forms[0].action.value;
Pclassnameltbl = document.forms[0].classNameLTBL.value;
Puserobject = document.forms[0].userObject.value;
Putente = document.forms[0].utente.value;
Pparametergrid = document.forms[0].parameterGrid.value;
Pjspobject = document.forms[0].jspObject.value;
Pvisualkey = document.forms[0].visualKey.value;
Pjsplist = document.forms[0].jspList.value;
Pservletforgrid = document.forms[0].servletForGrid.value;
Pservletexecutefromgrid = document.forms[0].servletExecuteFromGrid.value;
Pbasehref = document.forms[0].baseHref.value;
Ppage = document.forms[0].page.value;
Pcomponent = document.forms[0].component.value;
Pgridtype = document.forms[0].gridType.value;
Pmessagesltbl = document.forms[0].messagesLTBL.value;
Pgridcode = document.forms[0].gridCode.value;
Pgriduser = document.forms[0].gridUser.value;
Pjspwidth = document.forms[0].jspWidth.value;
Pjspheight = document.forms[0].jspHeight.value;
Psessid = document.forms[0].sessid.value;
Pbase = document.forms[0].base.value;
url = Pbase+"servlet/org.ltblfw.web.WebJson";
resultPageSize = 35;

var store = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({ url: url, method: 'GET' }),
baseParams : {
gridAction: Pgridaction,
action: Paction,
classNameLTBL: Pclassnameltbl,
userObject: Puserobject,
utente: Putente,
parameterGrid: Pparametergrid,
jspObject: Pjspobject,
visualKey: Pvisualkey,
jspList: Pjsplist,
servletForGrid: Pservletforgrid,
servletExecuteFromGrid: Pservletexecutefromgrid,
baseHref: Pbasehref,
page: Ppage,
component: Pcomponent,
gridType: Pgridtype,
messagesLTBL: Pmessagesltbl,
gridCode: Pgridcode,
gridUser: Pgriduser,
jspWidth: Pjspwidth,
jspHeight: Pjspheight,
sessid: Psessid
},
fields:[]
});
store.load({
params: {
start: 0,
limit: resultPageSize
}
});


var xgrid = new Ext.grid.GridPanel({
store:store,
columns:[],
height: 500,
loadMask: true,
viewConfig: {
onDataChange: function(){
this.cm.setConfig(this.ds.reader.jsonData.columns);
this.syncFocusEl(0);
}
},
bbar: new Ext.PagingToolbar({
store: store,
pageSize: resultPageSize
}),
renderTo: 'test'
});
store.on('datachanged',
function () {
xgrid.reconfigure(store, xgrid.getColumnModel())

}
)
});with this json result from my servlet :


{"metadata":
{"totalProperty": "total",
"root": "records",
"fields": [{"name":"Codice azienda","type":"string"},{"name":"Ragione sociale","type":"string"},{"name":"Codice lingua","type":"string"},{"name":" ","type":"string"}]
},"success": true,"total": 1,
"records": [{"Codice azienda":"001","Ragione sociale":"LTBL Srl","Codice lingua":"IT"," ":" "}],
"columns": [{"dataIndex":"Codice azienda","header":"Codice azienda","sortable":false},
{"dataIndex":"Ragione sociale","header":"Ragione sociale","sortable":false},
{"dataIndex":"Codice lingua","header":"Codice lingua","sortable":false},
{"dataIndex":" ","header":" ","sortable":false}]}...... in the grid i see only headers without rows loaded.....
I use extjs 3.2.1, someone can help me??
Thanks to all
(sorry for my english, i write from italy).