easyui-textbox

TextBox

扩展自 $.fn.validatebox.defaults. 重写 $.fn.textbox.defaults.

TextBox 是加强的输入控件,使我们建设表单更加快捷. 是一些复杂控件的基础控件,比如 combo,datebox,spinner,等等.

依赖
  • validatebox
  • linkbutton
实例

html创建方式

<input class="easyui-textbox" data-options="iconCls:'icon-search'" style="width:300px"> 

 

javascript创建方式

<input id="tb" type="text" style="width:300px"> 
$('#tb').textbox({ 
 buttonText:'Search', 
 iconCls:'icon-man', 
 iconAlign:'left' 
}) 

 

属性

属性拓展自 validatebox 控件,下面是textbox新添加的属性:

NameTypeDescriptionDefault
widthnumberThe width of the component.auto
heightnumberThe height of the component.22
promptstringThe prompt message to be displayed in input box.''
valuestringThe default value. 
typestringThe textbox type. Possible values are 'text' and 'password'.text
multilinebooleanDefines if this is a multiline textbox.false
editablebooleanDefines if user can type text directly into the field.true
disabledbooleanDefines if to disable the field.false
readonlybooleanDefines if the component is read-only.false
iconsarrayThe icons attached to the textbox. Each item has the following properties:
iconCls: string, the icon class.
disabled: boolean, indicate if the icon is disabled.
handler: function, the function to process the clicking action on this icon.

 

Code example:

$('#tb').textbox({
	icons: [{
		iconCls:'icon-add',
		handler: function(e){
			$(e.data.target).textbox('setValue', 'Something added!');
		}
	},{
		iconCls:'icon-remove',
		handler: function(e){
			$(e.data.target).textbox('clear');
		}
	}]
})
[]
iconClsstringThe background icon displayed on the textbox.null
iconAlignstringPosition of the icons. Possible values are 'left','right'.right
iconWidthnumberThe icon width.18
buttonTextstringThe displaying text of button that attached to the textbox. 
buttonIconstringThe displaying icon of button that attached to the textbox.null
buttonAlignstringPosition of the button. Possible values are 'left','right'.right
事件

事件拓展自 validatebox 控件,下面是textbox新添加的事件:

NameParametersDescription
onChangenewValue,oldValueFires when the field value is changed.
onResizewidth,heightFires when the textbox is resized.
onClickButtonnoneFires when the user click the button.
onClickIconindexFires when the user click a icon.
方法

方法拓展自 validatebox 控件,下面是textbox新添加的方法:

NameParameterDescription
optionsnoneReturn the options object.
textboxnoneReturn the textbox object.
buttonnoneReturn the button object.
destroynoneDestroy the textbox component.
resizewidthResize the component width.
disablenoneDisable the component.
enablenoneEnable the component.
readonlymodeEnable/Disable readonly mode.

 

Code example:

$('#tb').textbox('readonly');	// enable readonly mode
$('#tb').textbox('readonly',true);	// eanble readonly mode
$('#tb').textbox('readonly',false);	// disable readonly mode
clearnoneClear the component value.
resetnoneReset the component value.
setTexttextSet the displaying text value.
getTextnoneGet the displaying text value.
setValuevalueSet the component value.
getValuenoneGet the component value.
getIconindexGet specified icon object.

 

 

 

FileBox

拓展自 $.fn.textbox.defaults. 重写 $.fn.filebox.defaults.

由于浏览器安全问题, 一些方法 比如 'setValue' 不能使用filebox 组件.

依赖
  • textbox
实例

html创建方式

 

<input class="easyui-filebox" style="width:300px"> 

 

javascript创建方式

 

<input id="fb" type="text" style="width:300px"> 
$('#fb').filebox({ 
 buttonText: 'Choose File', 
 buttonAlign: 'left' 
}) 

 

属性

属性拓展自 textbox, 下面是 filebox新增属性.

NameTypeDescriptionDefault
buttonTextstringThe displaying text of button that attached to the textbox.Choose File
buttonIconstringThe displaying icon of button that attached to the textbox.null
buttonAlignstringPosition of the button. Possible values are 'left','right'.right
事件

事件拓展自 textbox.

方法

方法拓展自 textbox.

 

转载于:https://www.cnblogs.com/daviddeng/p/4368067.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值