PDA

View Full Version : reloading a panel



crazy
7 Oct 2009, 7:58 PM
hi all,

i have a small problem with reloading a panel.
what i need is ,
when i click on the 'cancel' button, every fields in that panel should be reloaded.
i searched for reloading a panel. bt i cant find anything.
so i tried to remove all the contents and add the panel once more. but the panel is not showing.
anyone help me plz........



{
region: 'center',
id: 'centre-panel',
xtype: 'panel',
frame: true,
items: [
{
xtype: 'tabpanel',
activeTab: 2,
items: [
{
title: 'Home',
frame: true,
items: [
homePanel
]
},
{
title: 'Profile',
frame: true,
items: [
//
]
},
{
title: 'Add Remarks',
id: 'remarks-panel',
frame: true,
items: [
commentsPanel
],
buttons: [
{
text:"Save",
handler: function()
{
}
},
{
text:"Cancel",
handler: function()
{
Ext.getCmp('remarks-panel').removeAll();
Ext.getCmp('remarks-panel').add(commentsPanel);
Ext.getCmp('remarks-panel').doLayout();
}
}
]
}
]
}
]
}


thanks in advance...
cRaZy

rblon
7 Oct 2009, 11:07 PM
What do mean with reloading the panel? Do you perhaps want to reload a grid inside the panel (or other data)?

crazy
8 Oct 2009, 12:50 AM
ya
actualy i want is to reload all the contents in the panel
that commentsPanel is a panel(Ext.Panel), which contains 2 formPanels(containing some text fields).
so when i click the 'cancel' button, all the fields want to be refreshed.

tubamanu
8 Oct 2009, 12:58 AM
do u load data from server when u click "cancel" button? or do u want to set some kind of default values ?

rblon
8 Oct 2009, 1:02 AM
ok so resetting each field should work, right? I am not sure if there is another / easier way to do it.

tubamanu
8 Oct 2009, 1:04 AM
don't know if there is an easyier way, u can change the value like this:

FIELDNAME.setValue('test');

crazy
8 Oct 2009, 1:17 AM
ok thanks for the replies....

but in the foll code, will u plz say how can i set the value



var commentsPanel1 = new Ext.form.FormPanel({
frame:true,
width: 500,
autoHeight: true,
defaultType:'textfield',
labelWidth: 200,
monitorValid:true,
items:[
{
fieldLabel: '<b>Label1</b>',
id: 'label1_id',
width:190,
allowBlank: false
},
{
fieldLabel: '<b>Label2</b>',
id: 'label2_id',
width:190,
allowBlank: false
},
{
fieldLabel: '<b>Label2</b>',
id: 'label2_id',
width:190
},
{
fieldLabel: '<b>Label3</b>',
id: 'label3_id',
width:190,
allowBlank: false
},
{
fieldLabel: '<b>Label4</b>',
id: 'label4_id',
width:190,
allowBlank: false
},
{
fieldLabel: '<b>Label5</b>',
id: 'label5_id',
width:190,
allowBlank: false
}
],
buttons: [
{
text: 'Submit',
handler: function(){
'label2_id'.setValue('hi');
alert('label1_id'.getValue());
}
}
],
renderTo: document.body
});





//'label2_id'.setValue('hi');
//alert('label1_id'.getValue());
both lines shows some error
what may be the error....

thanks in advance
cRaZy...

crazy
8 Oct 2009, 1:21 AM
ok thanks for the replies....

but in the foll code, will u plz say how can i set the value



var commentsPanel1 = new Ext.form.FormPanel({
frame:true,
width: 500,
autoHeight: true,
defaultType:'textfield',
labelWidth: 200,
monitorValid:true,
items:[
{
fieldLabel: '<b>Label1</b>',
id: 'label1_id',
width:190,
allowBlank: false
},
{
fieldLabel: '<b>Label2</b>',
id: 'label2_id',
width:190,
allowBlank: false
},
{
fieldLabel: '<b>Label2</b>',
id: 'label2_id',
width:190
},
{
fieldLabel: '<b>Label3</b>',
id: 'label3_id',
width:190,
allowBlank: false
},
{
fieldLabel: '<b>Label4</b>',
id: 'label4_id',
width:190,
allowBlank: false
},
{
fieldLabel: '<b>Label5</b>',
id: 'label5_id',
width:190,
allowBlank: false
}
],
buttons: [
{
text: 'Submit',
handler: function(){
'label2_id'.setValue('hi');
//alert('label1_id'.getValue());
}
}
],
renderTo: document.body
});





'label2_id'.setValue('hi');
//alert('label1_id'.getValue());
both lines shows some error
what may be the error....

crazy
8 Oct 2009, 1:39 AM
ok thanks for the replies....

but in the foll code, will u plz say how can i set the value



var commentsPanel1 = new Ext.form.FormPanel({
frame:true,
width: 500,
autoHeight: true,
defaultType:'textfield',
labelWidth: 200,
monitorValid:true,
items:[
{
fieldLabel: '<b>Label1</b>',
id: 'label1_id',
width:190,
allowBlank: false
},
{
fieldLabel: '<b>Label2</b>',
id: 'label2_id',
width:190,
allowBlank: false
},
{
fieldLabel: '<b>Label2</b>',
id: 'label2_id',
width:190
},
{
fieldLabel: '<b>Label3</b>',
id: 'label3_id',
width:190,
allowBlank: false
},
{
fieldLabel: '<b>Label4</b>',
id: 'label4_id',
width:190,
allowBlank: false
},
{
fieldLabel: '<b>Label5</b>',
id: 'label5_id',
width:190,
allowBlank: false
}
],
buttons: [
{
text: 'Submit',
handler: function(){
'label2_id'.setValue('hi');
alert('label1_id'.getValue());
}
}
],
renderTo: document.body
});





'label2_id'.setValue('hi');
//alert('label1_id'.getValue());
both lines shows some error
what may be the error....

hendricd
8 Oct 2009, 4:05 AM
@crazy --

Why are you acting crazy?
Why do you keep posting the same message every 5+ minutes?