Kamis, 05 Juni 2014

How to Create a Tooltip in EXTJS

This is the snippet for tooltip in EXTJS

{
    xtype: 'textfield',
    anchor: '100%',
    name: 'Alamat',
    fieldLabel: 'Alamat',
    emptyText: 'Alamat',
    listeners : {
       render: function(p) {
            var theElem = p.getEl();
            var theTip = Ext.create('Ext.tip.Tip', {
                html: 'Tuliskan nama jalan dan nomor rumah.<br>Misal: Jl. Merak, No. 3',
                margin: '0 0 0 200',
                shadow: false
            });
           
            p.getEl().on('mouseover', function(){
                theTip.showAt(theElem.getX(), theElem.getY());
            });
           
            p.getEl().on('mouseleave', function(){
                theTip.hide();
            });
        }
    }
},