Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
535
Tooltip on each Row
posted

Hi,

does anybody know how to implement a tooltip for a mouseover?

In one of our columns the text is to long to show, so we show only the first letters. The user should see the whole text when hovering over the cell or row...

Thanks for every idea!

Torsten

 

Parents
  • 33839
    Suggested Answer
    posted

    Hi Torsten,

    If you would like to show a default browser tooltip, that is fairly simple.  You just need to set the 'title' attribute of the cells.  This can be done in the initialize client side event.

    Here is an example handler. 

    function initGrid(grid, args) {
                var rows = grid.get_rows();
                var rowCount = rows.get_length();
                var cellCount = rowCount > 0 ? rows.get_row(0).get_cellCount() : 0;
                for (var r = 0; r < rowCount; ++r) {
                    var row = rows.get_row(r);
                    for (var c = 0; c < cellCount; ++c) {
                        var cell = row.get_cell(c);
                        var cellEl = row.get_cell(c).get_element();
                        cellEl.title = cell.get_text();
                    }
                }
            }

    Hopefully this accomplishes what you need. 

    regards,

    David Young

Reply Children