Results 1 to 6 of 6

Thread: tooltips

  1. #1

    Default tooltips

    hello everyone,
    I want to customer a tooltip for every cell for the grid, I have to get the rowIndex and colIndex of the mouse cursor. In the following code i can get the colIndex. but how can I get the rowIndex? thanks.
    Code:
    grid.getView().on('render', function(tempview) {
                tempview.tip = Ext.create('Ext.tip.ToolTip', {
                            target : tempview.el,
                            width : 100,
                            height : 100,
                            delegate : tempview.cellSelector,
                            trackMouse : true,
                            renderTo : Ext.getBody(),
                            listeners : {
                                beforeshow : function updateTipBody(tip, rowIndex) {
                                    var gridColums = tempview.getGridColumns();
                                    var column = gridColums[tip.triggerElement.cellIndex];  //'tip.triggerElement.cellIndex' is the colIndex
                                    var val = tempview
                                            .getRecord(tip.triggerElement.parentNode)
                                            .get(column.dataIndex);                             
                                    tip.update(val);
                                }
                            }
                        });
            });

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    1. Please post in the appropriate forum. I have moved this to the Ext JS 4 Q&A forum for you.
    2. Are you trying to have a tooltip special to each cell?
    Mitchell Simoens @LikelyMitch

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

    Posts are my own, not any current, past or future employer's.

  3. #3

    Default

    I'm sorry it's my first time to ask here.
    Yes, I want to custom tooltip for each cell according to the cell's content, so it's necessary for me to get the rowIndex and colIndex.

  4. #4
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    A column can take a renderer config which is a function. You can then add the attribute 'data-qtip' to a string on the element and if you have done the Ext.QuickTips.init() then it should pick this string up and automatically show a tooltip.
    Mitchell Simoens @LikelyMitch

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

    Posts are my own, not any current, past or future employer's.

  5. #5

    Default

    thanks.
    but it's difficult for me. Is there some simila example?

  6. #6
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    Code:
    {
        text     : 'Company',
        flex     : 1,
        sortable : false,
        dataIndex: 'company',
        renderer : function(value, meta, record, rowIndex, colIndex, store, view) {
            meta.tdAttr = 'data-qtip="Test"';
            return value;
        }
    }
    Mitchell Simoens @LikelyMitch

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

    Posts are my own, not any current, past or future employer's.

Posting Permissions

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