在ext3.x基础上 扩展2
来源:广州中睿信息技术有限公司官网
发布时间:2012/10/21 23:25:16 编辑:editor 阅读 512
简单的扩展,让表单的tooltip更简单,博客园写东西没预览功能吗?下面是预览效果,哈哈,看了下还好/***editbydickhead**goal扩展form表单元素,可以便捷的配置其toolti

简单的扩展,让表单的tooltip更简单,博客园写东西没预览功能吗?下面是预览效果,哈哈,看了下还好

 

  /*  ** edit by dickhead  ** goal 扩展form表单元素,可以便捷的配置其tooltip 。  ** 以插件或者其他方便插入的方式实现的扩展  ** time 2011-08-04 23:06:45  */    //<extension>  (function () {      var fieldTipTpl = new Ext.Template([              '<div style="padding-left:18px;border-bottom:1px dotted gray;',              'background:url(http://images.findicons.com/files/icons/99/office/16/info.png) no-repeat left center;',              'font-weight:bold;padding-bottom:2px;">提示</div>',              '<div style="padding:3px 2px;">{tip}</div>'          ].join(''));      fieldTipTpl.compile();      /*      ** @cfg tooltip {string} 一段描述性文字,可以是html代码段      */      Ext.form.Field.prototype.afterRender = Ext.form.Field.prototype.afterRender.createSequence(function () {          if (this.tooltip) {              var el = this.el.next() || this.el; //为什么要next?因为triggerfield(日期/下拉等空间)后面借这个img标签。              var tip = new Ext.ToolTip({                  target: el, autoHide: false, anchor: 'left',                  html: fieldTipTpl.apply({ tip: this.tooltip }),                  showDelay: 100000,                  onTargetOver: Ext.emptyFn              });              this.on('focus', function () {                  tip.show();              });              this.on('blur', function () {                  tip.hide();              });              this.on('destroy', function () {                  tip.destroy();              });          }      });  })();  //</extension>    Ext.onReady(function () {      new Ext.form.FormPanel({          border: false,          items: [              { xtype: 'textfield', tooltip: '不是你的就不是你的,该放手的就要放手,包括内存资源。',                  fieldLabel: '兴趣史'              },              { xtype: 'datefield', fieldLabel: '选择个日期',                  tooltip: 'Ext为什么叫ext。。。'              }          ],          renderTo: 'main'      });  });

  

 

联系我们CONTACT 扫一扫
愿景:成为最专业的软件研发服务领航者
中睿信息技术有限公司 广州•深圳 Tel:020-38931912 务实 Pragmatic
广州:广州市天河区翰景路1号金星大厦18层中睿信息 Fax:020-38931912 专业 Professional
深圳:深圳市福田区车公庙有色金属大厦509~510 Tel:0755-25855012 诚信 Integrity
所有权声明:PMI, PMP, Project Management Professional, PMI-ACP, PMI-PBA和PMBOK是项目管理协会(Project Management Institute, Inc.)的注册标志。
版权所有:广州中睿信息技术有限公司 粤ICP备13082838号-2