在Extjs中怎么给控件加上tips提示,就是鼠标放上去就有tips提示。

解决方案 »

  1.   


    Ext.onReady(function(){
        Ext.QuickTips.init();
        Ext.form.Field.prototype.msgTarget = 'qtip';//这2个是提示信息的设置项
    {
              fieldLabel: 'First Name',
              name: 'first',
              allowBlank:false
    }
      

  2.   


    Ext.onReady(function(){
        Ext.QuickTips.init();
        Ext.form.Field.prototype.msgTarget = 'qtip';//这2个是提示信息的设置项    new Ext.ToolTip({//ToolTip这个就是提示控件,刚才上面的是验证用的
            target: 'tip1',
            html: 'this is tip'
        });
    }
    <div id="tip1"></div>
      

  3.   

    我是给控件加个tips提示功能,不是添加验证提示
      

  4.   


    Ext.onReady(function(){
        Ext.QuickTips.init();
        Ext.form.Field.prototype.msgTarget = 'qtip';//这2个是提示信息的设置项    new Ext.ToolTip({//ToolTip这个就是提示控件,刚才上面的是验证用的
            target: 'tip1',//要给的控件id
            html: 'this is tip'
        });
    }
      

  5.   


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title>extPanel.html</title>

        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="this is my page">
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="ext-2.2/resources/css/ext-all.css" />
        <script type="text/javascript" src="ext-2.2/adapter/ext/ext-base.js"></script> <script type="text/javascript" src="ext-2.2/ext-all.js"></script>
        <script type="text/javascript">
         Ext.onReady(function () {
         Ext.QuickTips.init();
         Ext.form.Field.prototype.msgTarget = 'qtip';//这2个是提示信息的设置项
        
         var P = Ext.extend(Ext.Panel, {
         renderTo: Ext.getBody(),
         title: "panel",    
         width: 200,
         height: 200,
    closable : true,
    autoScroll : true,
    layout : "fit",
    maskDisabled : false,
    buttons: [new Ext.Button({text: "button", tooltip: "this is my Panel"})],
    gridViewConfig : {
    animate : true
    }
    });
    new P();

         });
        </script>  </head>
      
      <body>
        This is my HTML page. <br>
      </body>
    </html>
      

  6.   

    那个target后面可以写控件名吗?指定是哪个控件。
      

  7.   

    我可以动态给target指定值吗,先new,然后setTarget之类的方法???