zie*_*ini 3 extjs datafield sencha-touch
我这次的问题是让一个项目出现并消失.我知道它完成了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);
Run Code Online (Sandbox Code Playgroud)
谢谢.我试着说:
{
xtype: "datepickerfield",
id: "startDate",
label: "when",
picker: { yearFrom: 2012, yearTo: 2020}
this.items.getAt().hide();
},
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
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},
},
Run Code Online (Sandbox Code Playgroud)
我试过这个,但它不起作用
您可以使用以下两种方法之一:hide()/show()
或setVisible(true/false)
.
如果要访问对象内的项(例如,在initComponent()事件内),请使用以下子句:
this.items.getAt(<index of item>).hide();
this.items.getAt(<index of item>).show();
Run Code Online (Sandbox Code Playgroud)
为了设置对类外的元素的访问,你可以使用getCmp()方法:
var el = Ext.getCmp("elementID");
Run Code Online (Sandbox Code Playgroud)
然后访问该项目并设置其可见性.
el.items.getAt(<index of item>).setVisible(false); // hide
el.items.getAt(<index of item>).setVisible(true); // show
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
25109 次 |
最近记录: |