PDA

View Full Version : QUESTION: Populating Form with Ext.Direct and ExtDirectCF



kpopov
24 Jul 2009, 2:42 PM
I was wondering if someone can help me identify a problem with this code. I am trying to put together a prototype of a form being populated via ExtDirectCF and CFQueryReader.

Here is my JS file:


Ext.BLANK_IMAGE_URL = '/Frameworks/ext/resources/images/default/s.gif';

Ext.onReady(function(){

Ext.Direct.addProvider(Ext.ss.APIDesc);

var fieldDef = [
{name:'ESTIMATEPK', mapping:'ESTIMATEPK', type:'int'}
,{name:'ESTIMATENO', mapping:'ESTIMATENO', type:'string'}
,{name:'ESTIMATENAME', mapping:'ESTIMATENAME', type:'string'}
,{name:'ESTIMATETOTAL', mapping:'ESTIMATETOTAL', type:'string'}
,{name:'ESTIMATEDATE', mapping:'ESTIMATEDATE', type:'string'}
];

var formReader = new Ext.data.CFQueryReader({
id:'ESTIMATEPK',
root:'getData'
},fieldDef);



var estimateForm = new Ext.form.FormPanel({
// configs for FormPanel
title: 'Estimate Detials',
labelAlign: 'top',
frame:true,
reader: formReader,

bodyStyle:'padding:5px 5px 0',
width: 750,
renderTo: 'divActivities',
padding: 10,
buttons:[{
text: 'Submit',
handler: function(){
estimateForm.getForm().submit({
params: {
uid: Ext.localData.EstimateDetails.EstimatePK
}
});
}
}],

// configs apply to child items
defaults: {anchor: '-20'},
defaultType: 'textfield',
items: [{
fieldLabel: 'Name',
name: 'ESTIMATENAME'
},{
fieldLabel: 'Number',
msgTarget: 'side',
name: 'ESTIMATENO'
}],
// configs for BasicForm
api: {
// The server-side method to call for load() requests
load: Ext.ss["JMS.ExtDirect.Estimate"].get
},
// specify the order for the passed params
paramsAsHash: false,
paramOrder: ['uid']
});

estimateForm.getForm().load({
params: {
uid: Ext.localData.EstimateDetails.EstimatePK
}
});

});The code successfully makes a call to the router and this is what is returned:


[{"method":"get","tid":3.0,"action":"JMS.ExtDirect.Estimate","type":"rpc","data":[1.0],"result":{"SUCCESS":true,"TOTALROWCOUNT":1,"getData":{"COLUMNS":["ESTIMATEPK","ESTIMATENO","ESTIMATENAME","ESTIMATEDATE","ESTIMATETOTAL"],"DATA":[[1,"XXXXX-001-01","TEST Station - Estimate Original Request","2008-01-01",1000.0000]]}}}]For some reason the CFQueryReader never gets called. I don't have any errors in FB but the form does not get populated.

I would really appreciate any hints.