亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Extjs NumberField后面加單位實(shí)現(xiàn)思路

 更新時(shí)間:2013年07月30日 15:59:34   作者:  
本文為大家介紹下在NumberField后面加單位,具體實(shí)現(xiàn)如下,感興趣的朋友可以參考下
UnitText.js
=======================
復(fù)制代碼 代碼如下:

// 輸入框textfield后面放字unitText定義:
Ext.override(Ext.form.TextField, {
unitText : '',
onRender : function(ct, position) {
Ext.form.TextField.superclass.onRender.call(this,ct, position);

if (this.unitText != ''){
this.unitEl =ct.createChild({
tag: 'div',
html: this.unitText this.unitEl.addClass('x-form-unit'); this.width =this.width
-(this.unitText.replace(/[^\x00-\xff]/g, "xx").length * 6 +2); this.alignErrorIcon= function() {
this.errorIcon.alignTo(this.unitEl,'tl-tr', [2, 0]); }});

將UnitText.js放入到j(luò)sp文件中,加上css樣式,如下:
復(fù)制代碼 代碼如下:

<style>
.x-form-unit{
height:22px;
line-height:22px;
padding-left:2px;
display:inline-block;
display:inline; </style>
<script type="text/javascript"src="UnitText.js"></script>

這樣就可以用了,使用方法如下:
復(fù)制代碼 代碼如下:

var jine = new Ext.form.NumberField({
id: 'je',
fieldLabel: '金額',
allowDecimals: true, // 允許小數(shù)點(diǎn)?
allowNegative: false, // 允許負(fù)數(shù)?
width: 100,
style: 'text-align:right',
unitText: ' 元'
});

相關(guān)文章

最新評論