功能要求:在master plan系統中,copy一個新的masterplan時,添加一個有輸入框的提示框,使項目名稱可編輯 如圖所示:
思路:在form中添加一個隱藏字段,然後將用戶輸入的項目名稱設置到隱藏字段中,提交後臺….
添加隱藏字段:
this.fields.add("project_hidden",new Ext.form.Hidden ({xtype: "hidden",name:"project_hidden",id:"project_hidden",width:150,allowBlank:false,labelSeparator:":*" ,fieldLabel: "project_hidden",insert_allowed:true,update_allowed:true}));
提示框 Ext.Msg.show({
title:'Copy',msg: '您將copy一個新的master plan,是否修改項目名('+project_id+')?',buttons: Ext.Msg.YESNO,modal:false,scope:this,icon: Ext.MessageBox.QUESTION
,fn: function(btn,txt){
if (btn=='yes') {
if (this.fields.get('MP_ID_manipulate').getValue() != this.fields.get('MP_ID').getValue()){
Ext.Msg.alert('操作不成功,請重試!');
}else{
this.fields.get('project_hidden').setValue(txt); //將輸入值設置到虛擬字段中
console.log("the test value is :==="+this.fields.get('project_hidden').getValue()+"-----txt is -----"+txt);
if (!MasterWriteAccess && !this.getCommitAllowVariable()) this.commitForm();
}
}
},prompt:true//顯示輸入框
});