1
我想提交從菜單按鈕的值,但知道這是不可能的,我必須創建一個隱藏的字段,並在那裏存儲按鈕值。ExtJs提交menubutton值
作爲ExtJs的新手,我似乎無法弄清楚如何做到這一點。以下是我用來檢查按鈕顯示的基本佈局,我可以選擇一種顏色。
getFormItems : function() {
var me = this;
return [{
xtype : "fieldset",
title : "Items to monitor",
defaults : {
labelSeparator : ""
},
items : [{
xtype : "checkbox",
name : "cpuenable",
boxLabel : _("Will monitor CPU Temperature"),
fieldLabel : _("CPU Temperature"),
checked : false
},{
xtype : 'hiddenfield',
id : 'buttonvalues'
},{
xtype : "button",
name : "colours",
text : _("Choose Colours"),
scope : this,
style : {
marginTop : "10px",
marginBottom : "10px"
},
menu: [{
text: "Main CPU Colour",
menu: {
xtype : "colormenu",
name : "colourc",
value : "000000",
cls : "menubutton-class",
handler: function (obj, rgb) {
var colourmField = this.findField('colourc');
colourmField.setValue(rgb.toString());
alert(colourmField.getValue());
}
}
},{ and so on
感謝您的回答,我更新了代碼以chec k如果目前爲止是正確的。 – jhmiller 2014-09-28 12:21:52
每次我嘗試使用Ext.Array時,它都會停止工作的代碼。現在是否有機會檢查代碼是否存在錯誤。 – jhmiller 2014-09-28 12:50:34
我現在完全失去了,嘗試了所有我能想到的使用上述建議,但無法快速完成。 Tyr或其他人可以提供更多關於如何實現目標的細節。 – jhmiller 2014-09-28 18:43:44