CheckBox (checkbox) is mainly used to receive options selected by the user.
As shown in the figure (please ignore the bad looks of the UI):
The main code of this pop-up window is as follows:
The code copy is as follows:
var win = new Ext.Window({
modal : true,
title: 'Are you sure you want to reject the table? ',
width: 500,
plain : true,
items: [fp]
});
win.show();
The pop-up window is the carrier, and the [fp] in items is the handle to the form form.
The specific definition is as follows:
The code copy is as follows:
var fp = Ext.create('Ext.FormPanel', {
frame: true,
fieldDefaults: {
labelWidth: 110
},
width: 500,
bodyPadding: 10,
Items: [
{
xtype: 'fieldset',
flex: 1,
//title: 'Are you sure you want to reject the table? ',
defaultType: 'checkbox',
layout: 'anchor',
defaults: {
anchor: '100%',
hideEmptyLabel: false
},
items:[{
fieldLabel: 'Please select the reason for rejection:',
boxLabel: 'This form is not filled in in full. ',
name:'integrity',
inputValue: '1'
}, {
name:'correct',
boxLabel: 'The form is not filled in accurately. ',
inputValue: '1'
}]
}],
buttons: [
{text: 'Confirm',handler: function(){
//If you get completeness and accuracy information, it is 1, but not 0
if(fp.getForm().isValid()){
console.log(fp.getForm().findField('integrity').getValue()?1:0);
console.log(fp.getForm().findField('correct').getValue()?1:0)
}
win.hide();
}
},{
text: 'Cancel',
handler: function(){
win.hide();
}
}]
});
This basically covers all the information of interest. For details, please refer to the API itself.
Focus on getting the value of checkBox
The code copy is as follows:
console.log(fp.getForm().findField('integrity').getValue()?1:0);
console.log(fp.getForm().findField('correct').getValue()?1:0)
These two sentences are how to obtain the value of integrity and correctness.