JAVA工具
          JAVA使用軟件 開發工具
          posts - 87,  comments - 9,  trackbacks - 0
          Extjs.form.TextField的默認在輸入框后面是不能加入文字。在網上找到此方法以備查用。
          在頁面中引入此段js代碼
          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]);   
                        };   
                      }   
                        }   
                  })  
          再加入些樣式
          <style>
                  .x-form-unit {  
                      height: 22px;  
                      line-height: 22px;  
                      padding-left: 2px;  
                      display: inline-block;  
                      display: inline;  
                  } 
              </style>


          posted on 2011-07-14 11:28 王豪 閱讀(560) 評論(0)  編輯  收藏 所屬分類: EXT 筆記

          常用鏈接

          留言簿

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 涟水县| 肇源县| 滁州市| 克东县| 壶关县| 茶陵县| 沁源县| 叙永县| 丹寨县| 同心县| 乾安县| 翁牛特旗| 上林县| 阿坝| 环江| 河间市| 富蕴县| 高尔夫| 忻城县| 东兴市| 来宾市| 林口县| 潜山县| 宣武区| 柘城县| 襄垣县| 邻水| 岱山县| 林周县| 定南县| 南江县| 牙克石市| 汕头市| 苏尼特左旗| 西青区| 密山市| 双城市| 乐安县| 德兴市| 卫辉市| 岑巩县|