发布于 2017-06-21 03:48:20 | 104 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的Javascript教程,程序狗速度看过来!

JavaScript客户端脚本语言

Javascript 是一种由Netscape的LiveScript发展而来的原型化继承的基于对象的动态类型的区分大小写的客户端脚本语言,主要目的是为了解决服务器端语言,比如Perl,遗留的速度问题,为客户提供更流畅的浏览效果。


CheckBox(复选框)主要用来接收用户选择的选项,那么如何通过Extjs 4.x 得到form CheckBox的值呢?下面有个不错的方法,大家值得一看
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) 

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

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务