JAVA工具
          JAVA使用軟件 開(kāi)發(fā)工具
          posts - 87,  comments - 9,  trackbacks - 0
          Extjs.form.TextField的默認(rèn)在輸入框后面是不能加入文字。在網(wǎng)上找到此方法以備查用。
          在頁(yè)面中引入此段js代碼
          Ext.override(Ext.form.TextField, {   
                        unitText : '',   
                        onRender : function(ct, position) {   
                      Ext.form.TextField.superclass.onRender.call(this, ct, position);   
                          // 如果單位字符串已定義 則在后方增加單位對(duì)象   
                      if (this.unitText != '') {   
                        this.unitEl = ct.createChild({   
                          tag : 'div',   
                          html : this.unitText   
                       });   
                        this.unitEl.addClass('x-form-unit');   
                            // 增加單位名稱的同時(shí) 按單位名稱大小減少文本框的長(zhǎng)度 初步考慮了中英文混排 未考慮為負(fù)的情況   
                        this.width = this.width - (this.unitText.replace(/[^\x00-\xff]/g, "xx").length * 6 + 2);   
                            // 同時(shí)修改錯(cuò)誤提示圖標(biāo)的位置   
                        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 王豪 閱讀(562) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): EXT 筆記

          常用鏈接

          留言簿

          隨筆分類(lèi)

          隨筆檔案

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 申扎县| 霞浦县| 龙陵县| 义马市| 福泉市| 武陟县| 稻城县| 芦山县| 江城| 平泉县| 吉水县| 龙江县| 虎林市| 正安县| 湛江市| 平遥县| 营山县| 邯郸市| 麻城市| 天气| 衡山县| 江津市| 如东县| 平顶山市| 林周县| 西和县| 辽源市| 景德镇市| 田东县| 白朗县| 潞西市| 汉沽区| 乡宁县| 资讯 | 德江县| 定安县| 临武县| 县级市| 高密市| 双辽市| 塔城市|