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 王豪 閱讀(565) 評論(0)  編輯  收藏 所屬分類: EXT 筆記

          常用鏈接

          留言簿

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 辽宁省| 老河口市| 邹城市| 平远县| 定边县| 阳山县| 伊金霍洛旗| 清水河县| 中超| 定陶县| 新宾| 临清市| 巧家县| 隆化县| 公主岭市| 黎平县| 拉萨市| 大名县| 涞源县| 兴和县| 静乐县| 体育| 错那县| 图木舒克市| 宝清县| 北京市| 甘孜| 刚察县| 宜川县| 紫金县| 微山县| 和顺县| 博客| 荆州市| 固阳县| 保康县| 沧州市| 上饶县| 黄大仙区| 岳池县| 祁连县|