广州明生堂生物科技有限公司


Extjs 4.x 得到form CheckBox 复选框的值

网络编程 Extjs 4.x 得到form CheckBox 复选框的值 06-21
CheckBox(复选框)主要用来接收用户选择的选项

如图所示(请忽略UI的不好看):

查看图片

该弹出窗口的主要代码如下:

var win = new Ext.Window({
modal : true,
title : '确定要拒绝该表吗?',
width : 500,
plain : true,
items : [fp]
});
win.show();

弹出的窗口是载体,items里面的[fp]是form表单的句柄。

具体定义如下:

var fp = Ext.create('Ext.FormPanel', {
frame: true,
fieldDefaults: {
labelWidth: 110
},
width: 500,
bodyPadding: 10,
items: [
{
xtype: 'fieldset',
flex: 1,
//title: '确定要拒绝该张表吗?',
defaultType: 'checkbox',
layout: 'anchor',
defaults: {
anchor: '100%',
hideEmptyLabel: false
},
items:[{
fieldLabel: '请选择拒绝原因:',
boxLabel: '该表没有填写完整。',
name:'integrity',
inputValue: '1'
}, {
name:'correct',
boxLabel: '该表填写不准确。',
inputValue: '1'
}]
}],
buttons: [
{text: '确认',handler: function(){
//得到完整性和准确性信息 有则为1 没有为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: '取消',
handler: function(){
   win.hide();
 }
  }]
  });

这里面基本涵盖了所有的感兴趣的信息。具体的参见API吧本身不难

着重说下得到checkBox的值

console.log(fp.getForm().findField('integrity').getValue()?1:0);
console.log(fp.getForm().findField('correct').getValue()?1:0)

这两句话就是如何得到完整性和正确性的值。

ExtJS中设置下拉列表框不可编辑的方法
ExtJS这个框架,并没有学习和用过,只知道是一个流行的前段框架,和EasyUI,BUI,DWZ等这些框架都是差不多的,只不过比他们更加强大而已,之所以写这个

Ext修改GridPanel数据和字体颜色、css属性等
Ext修改GridPanel数据和字体颜色等,不是单指EditGridPanel首先获取选中的行(当然也可以获取单元格):varselectedRow=grid.getSelectionModel().getSelected();修改设置

extjs每个组件要设置唯一的ID否则会出错
extjs每个组件要设置唯一的ID,否则会造成各种错误EXTJS基本上是靠ID来识别组件的,假如你在panel1中有个ID:"keyword"的textfield,而panel2中有个ID相同的textfie


编辑:广州明生堂生物科技有限公司

标签:组件,中有,框架,完整性,都是