1
我的觀點如下有按鈕:extjs4 MVC Ext.ComponentQuery.query(...)調用setVisible不是一個函數
initComponent: function() {
this.layout = {
type: 'vbox',
align: 'center',
pack: 'center'
};
this.items = [
Ext.create('Ext.Button', {
name:'loginButton',
action:'login',
text: 'Login',
scale : 'medium',
width: 100,
itemId:'loginButton',
handler: function() {
//any default action here
}
})
];
現在
在控制器我想隱藏按鈕,我寫的
Ext.ComponentQuery.query('button[text=Login]').setVisible(false);
但它得到一個錯誤。
TypeError: Ext.ComponentQuery.query(...).setVisible is not a function
請幫我...
怎麼樣?請給我示例代碼。我曾嘗試過 Ext.ComponentQuery.query('button [text = Login]')[0] .setVisible(false); 但沒有奏效。 順便說一句,感謝您的快速響應.. – 2013-03-11 07:52:36
使用您的瀏覽器的控制檯,看看你回來... ** Ext.ComponentQuery.query('button [text = Login]')[0] .setVisible(false ); **正在完美工作!也許你有兩個帶有「登錄」文本的按鈕,而你正在隱藏另一個。 – harry 2013-03-11 10:41:21