这次我的问题是让一个项目出现和消失。我知道它已经完成了hide()
,show()
但我不知道怎么做?这是我的代码。当我在“selectfield”中选择“约会”时,我想让 xtype 出现:“datepickerfield”
App.views.Bankingrendezvous = Ext.extend(Ext.Panel, {
items: [{
xtype: 'formpanel',
id: 'form',
fullscreen: true,
scroll: 'vertical',
items: [{
xtype: 'fieldset',
title: 'Information & Appointment',
},
{
xtype: 'selectfield',
id: 'request',
label: 'You need',
options: [
{
text: 'Appointment',
value: 'Appointment'
},
{
text: 'Information',
value: 'Information',
}]
},
{
xtype: "datepickerfield",
id: "startDate",
label: "when",
picker: { yearFrom: 2012, yearTo: 2020}
},}]
}]
});
Ext.reg('Bankingrendezvous', App.views.Bankingrendezvous);
谢谢你。我按你说的试过了:
{
xtype: "datepickerfield",
id: "startDate",
label: "when",
picker: { yearFrom: 2012, yearTo: 2020}
this.items.getAt().hide();
},
但它不起作用。
items: [{
xtype: 'formpanel',
id: 'form',
fullscreen: true,
scroll: 'vertical',
items: [{
xtype: 'fieldset',
title: 'Information & Appointment',
},
{
xtype: 'selectfield',
id: 'request',
label: 'You need',
options: [
{
text: 'Appointment',
value: 'Appointment'
},
{
text: 'Information',
value: 'Information',
}],
listeners: {
function()
{
if (Ext.getCmp('request').getValue() == 'Information')
{
Ext.getCmp('startDate').hide();
}
}
},
},
{
xtype: "datepickerfield",
id: 'startDate',
label: "when",
picker: { yearFrom: 2012, yearTo: 2020},
},
我试过了,但它不起作用