Results 1 to 4 of 4

Thread: Need help related to tooltip functionality

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    2
    Vote Rating
    0
      0  

    Default Need help related to tooltip functionality

    We are using EXTJS 3.1.0

    There is a functionality where we have to add tooltip to an image, using code:

    function loadToolTip(objImageId,entity_id,entity_type){
    var objImage = document.getElementById(objImageId);

    var tp = new Ext.ToolTip({
    target: objImage,
    autoLoad: {url: some URL},
    showDelay:500
    });
    var extObjImage = Ext.get(objImageId);
    tp.showAt([extObjImage.getX()+25,extObjImage.getY()+25]);
    if(tp.anchorEl){
    tp.anchorEl.hide();
    }

    This function is called on the mousover event of a image.

    It is possible that the user does mousover on the image after changing some data and everytime we have to get the tooltip contents from the server.

    The problem we are facing is, it creates multiple tool tips every time we do an mouse over.

    Ideally we would want it to be displayed only once. We tried giving id to the tool tip object and then calling .destroy() method on that object when mouseout event occurs. This also does not work and at times gives JS error.

  2. #2
    Sencha User
    Join Date
    Dec 2011
    Posts
    2
    Vote Rating
    0
      0  

    Default Need help related to tooltip functionality

    We are using EXTJS 3.1.0

    There is a functionality where we have to add tooltip to an image, using code:

    function loadToolTip(objImageId,entity_id,entity_type){
    var objImage = document.getElementById(objImageId);

    var tp = new Ext.ToolTip({
    target: objImage,
    autoLoad: {url: some URL},
    showDelay:500
    });
    var extObjImage = Ext.get(objImageId);
    tp.showAt([extObjImage.getX()+25,extObjImage.getY()+25]);
    if(tp.anchorEl){
    tp.anchorEl.hide();
    }

    This function is called on the mousover event of a image.

    It is possible that the user does mousover on the image after changing some data and everytime we have to get the tooltip contents from the server.

    The problem we are facing is, it creates multiple tool tips every time we do an mouse over.

    Ideally we would want it to be displayed only once. We tried giving id to the tool tip object and then calling .destroy() method on that object when mouseout event occurs. This also does not work and at times gives JS error.

  3. #3
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Vote Rating
    1381
      0  

    Default

    All you have to do is save a reference to the tooltip somewhere like on a component as a property so that when the mouseout fires you can easily grab the reference.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #4
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Vote Rating
    1381
      0  

    Default

    Moved to Ext JS 3 Help forum.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •