Results 1 to 5 of 5

Thread: Tooltip on Tree parentNode

  1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    48
    Vote Rating
    1
      0  

    Default Answered: Tooltip on Tree parentNode

    the reqular data-qtip does work on my treepanel... but it shows up on all leafs too. How to check if the mouseover is on the parentNode... I am doing this on the listener of treePanel... is there a method that has isParentNode = true... that way I can just hide or show the tooltip accordingly

  2. Add a listener to your tree like this:

    Code:
    listeners: {
        itemmouseenter: function (view, rec) {
            console.log(rec.isLeaf());
        }
    }
    The second param passed is the record (nodeInterface).

    example:
    Code:
    var store = Ext.create('Ext.data.TreeStore', {
        root: {
            expanded: true,
            children: [
                { text: "detention", leaf: true },
                { text: "homework", expanded: true, children: [
                    { text: "book report", leaf: true },
                    { text: "alegrbra", leaf: true}
                ] },
                { text: "buy lottery tickets", leaf: true }
            ]
        }
    });
    
    
    Ext.create('Ext.tree.Panel', {
        title: 'Simple Tree',
        width: 200,
        height: 150,
        store: store,
        rootVisible: false,
        renderTo: Ext.getBody()
        , listeners: {
            itemmouseenter: function (view, rec) {
                console.log(rec.isLeaf());
            }
        }
    });

  3. #2
    Sencha - Documentation Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,162
    Answers
    501
    Vote Rating
    257
      0  

  4. #3
    Sencha User
    Join Date
    Sep 2012
    Posts
    48
    Vote Rating
    1
      0  

    Default

    I was thinking the same, but how do we get the value in itemmouseover
    Code:
    itemmouseenter: function (e, t) {
                        var v = Ext.getCmp('myTree').isleaf();
                        console.log(v);
                    }
    I am doing this and it's giving me an error

  5. #4
    Sencha - Documentation Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,162
    Answers
    501
    Vote Rating
    257
      0  

    Default

    Add a listener to your tree like this:

    Code:
    listeners: {
        itemmouseenter: function (view, rec) {
            console.log(rec.isLeaf());
        }
    }
    The second param passed is the record (nodeInterface).

    example:
    Code:
    var store = Ext.create('Ext.data.TreeStore', {
        root: {
            expanded: true,
            children: [
                { text: "detention", leaf: true },
                { text: "homework", expanded: true, children: [
                    { text: "book report", leaf: true },
                    { text: "alegrbra", leaf: true}
                ] },
                { text: "buy lottery tickets", leaf: true }
            ]
        }
    });
    
    
    Ext.create('Ext.tree.Panel', {
        title: 'Simple Tree',
        width: 200,
        height: 150,
        store: store,
        rootVisible: false,
        renderTo: Ext.getBody()
        , listeners: {
            itemmouseenter: function (view, rec) {
                console.log(rec.isLeaf());
            }
        }
    });

  6. #5
    Sencha User
    Join Date
    Sep 2012
    Posts
    48
    Vote Rating
    1
      0  

    Default

    ... thank you slemmon... you are aweome

    Quote Originally Posted by slemmon View Post
    Add a listener to your tree like this:

    Code:
    listeners: {
        itemmouseenter: function (view, rec) {
            console.log(rec.isLeaf());
        }
    }
    The second param passed is the record (nodeInterface).

    example:
    Code:
    var store = Ext.create('Ext.data.TreeStore', {
        root: {
            expanded: true,
            children: [
                { text: "detention", leaf: true },
                { text: "homework", expanded: true, children: [
                    { text: "book report", leaf: true },
                    { text: "alegrbra", leaf: true}
                ] },
                { text: "buy lottery tickets", leaf: true }
            ]
        }
    });
    
    
    Ext.create('Ext.tree.Panel', {
        title: 'Simple Tree',
        width: 200,
        height: 150,
        store: store,
        rootVisible: false,
        renderTo: Ext.getBody()
        , listeners: {
            itemmouseenter: function (view, rec) {
                console.log(rec.isLeaf());
            }
        }
    });

Tags for this Thread

Posting Permissions

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