PDA

View Full Version : xtype display, can't change displayed value



mice-pace
20 Feb 2013, 9:58 PM
The following code throws no errors, the console logging shows the expected values, but the display fields i fetch to set the value of remain stubbornly unchanged


Ext.getCmp('booking_appointment_personnel_lastname').setValue(appointment.personnel.lastname);
console.log('lastname: '+appointment.personnel.lastname);
Ext.getCmp('booking_appointment_personnel_firstname').setValue(appointment.personnel.firstname);
console.log('firstname: '+appointment.personnel.firstname);
Ext.getCmp('booking_appointment_time').setValue(appointment.time);
Ext.getCmp('booking_appointment_time').doComponentLayout() ;
console.log('time: '+appointment.time);
Ext.getCmp('booking_appointment_date').setValue(appointment.date);
console.log('date: '+appointment.date);


There *is* an error being thrown, but it seems to be unrelated since it was there before I added this code, appears in the logs AFTER all of the console outputs.

I doubt it can be that i have failed to fetch the fields, otherwise it would throw an error that i'm calling a method of undefined.

evant
20 Feb 2013, 10:13 PM
There's not enough information here, you'll need to post a test case.

sword-it
20 Feb 2013, 10:15 PM
Hi,

try following code it will be helpfull for you :




Ext.create('Ext.form.Panel', {
title: 'Simple Form',
bodyPadding: 5,
width: 350,
layout: 'anchor',
defaults: {
anchor: '100%'
},


defaultType: 'displayfield',
items: [{
fieldLabel: 'First Name',
name: 'first',
id:'name',
value:' First Name'
},{
fieldLabel: 'Last Name',
name: 'last',
id:'last',
value:'Last Name'
}],


buttons: [{
text: 'Set Value',
handler: function() {
Ext.getCmp('name').setValue('Form');
Ext.getCmp('last').setValue('Panel')
}
}],
renderTo: Ext.getBody()
});