jqgrid tooltip for header cells only

后端 未结 3 1857
说谎
说谎 2020-12-16 17:50

How can i add tooltip to my jqgrid header cells? in case of multiple grids in the same page.

This is my code:

var initialized = [false,false,false];
         


        
3条回答
  •  情歌与酒
    2020-12-16 17:57

    Just include headertitles:true option in your jqGrid definition.

    UPDATED: If you want set custom tooltip on a column header you can do following:

    var setTooltipsOnColumnHeader = function (grid, iColumn, text) {
        var thd = jQuery("thead:first", grid[0].grid.hDiv)[0];
        jQuery("tr.ui-jqgrid-labels th:eq(" + iColumn + ")", thd).attr("title", text);
    };
    
    setTooltipsOnColumnHeader($("#list"), 1, "bla bla");
    

    You should take in the consideration, that the column number iColumn is the 0-based absolute index of the column. Every from the options rownumbers:true, multiselect:true or subGrid:true include an additional column at the beginning, so the corresponding iColumn index should be increased.

    UPDATED 2: For more information about the structure of dives, internal grid.hDiv elements and the classes used by jqGrid see this answer.

提交回复
热议问题