UnitText.js
=======================
// Put the word unitText after the input box textfield definition:
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]); }});
Put UnitText.js into the jsp file and add css style, as follows:
This way you can use it. The usage method is as follows:
var jine = new Ext.form.NumberField({
id: 'je' ,
fieldLabel: 'Amount',
allowDecimals: true, // Allow decimal points?
allowNegative: false, // Allow negative numbers?
width: 100,
style: 'text-align:right',
unitText: '元'
});
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn