PDA

View Full Version : Need help with the getForm().loadRecord(record) method. not working



jazz_sencha
18 Mar 2011, 7:25 PM
Hi ,

I have a window which have a tab panel having three tabs and in one of them , i have a form panel, So while loading the window, I am giving a DWR call to get the banker record inside the Onrender method of the window panel and trying to load the response object to the form panel

the code looks like this:

onRender: function(ct, position) {

BankerService.getBanker(bankerid, function(ExtForm){

//banker the ref object for the tab panel
//details ref object from the banker form panel
//banker is the java model (bean class) which has all the banker values

this.banker.details.getForm().loadRecord(ExtForm.data.banker);

}.createDelegate(this));
}

In the reponse object i was able to get all the values inside the render function, but the values are not getting set into the from panel variables. Below is the code block for the form panel

ILC.ui.bankerDetailForm = Ext.extend(Ext.FormPanel,{

initComponent:function() {

var config = {
ref: '/details',
frame:true,
bodyStyle: 'padding: 0px 5px 0px 5px;',

//width:680,
items: [{
layout:'column', //Layout defined for the from panel
items:[{ //First Column starts here
columnWidth:.5,
layout: 'form',
anchor:'96%',
labelWidth: 133,
bodyStyle: 'padding:5px;',
items: [{ // Column -1 : Row -1
xtype: 'fieldset',
title: 'Installation Information',
autoHeight: true,
readOnly: true,
items :[
{
xtype: 'displayfield',
fieldLabel: 'bankerNumber',
name: 'bankNumber',
id:'mNumber'
},
{
xtype: 'displayfield',
fieldLabel: 'Lat/Long',
name: 'lattitude',
},
.........

This code is not throwing any errors or warnings.. but the form is just not getting populated.

Any pointers would be of great help.

Thanks
jazz

leomdg
13 Jun 2011, 12:14 PM
Same here ):

diegotdai
13 Jun 2011, 12:39 PM
I don't think there is an onRender event on Ext.Window class, try to change the line bellow


onRender: function(ct, position) {to


render: function(ct, position) {hope this helps

skirtle
13 Jun 2011, 5:18 PM
@diegotdai, I believe jazz is overriding the onRender() method, not adding an event listener. The comment on that method in the source (http://http://dev.sencha.com/deploy/ext-3.4.0/docs/source/Window.html) claims it is private but as with so many Ext methods there's a fine line between genuinely private methods and protected template methods.

A few suggestions...


Perhaps, as diegotdai suggests, you'd be better off using an event listener.
Your override doesn't call the superclass implementation. The use of createDelegate() is also worrying.
Have you tried overriding the afterRender() method instead, or listening to the afterrender event?
Try calling loadRecord() after a time delay (using defer()). This will help to confirm whether it is simply a timing issue or whether your call to loadRecord() is just plain not working.
Do the names on your fields definitely match the names in your record?
Have you tried adding a break point on loadRecord() and stepping into the code to see why it doesn't work?