jqgrid change column title attribute

拈花ヽ惹草 提交于 2020-01-01 16:49:09

问题


When I hover over a particular cell value, the hover value is same as the cell value. Can I change the hover text different from the cell value?

Thanks


回答1:


In general the tooltip is the title attribute of the <td> elements. You can use setCell method to change the tooltip (see this). In more complex situations you can use jQuery.attr (see here) or you a tooltip plugin (see here).




回答2:


You can use cellattr attribute in the colModel for a column to set custom tooltip. For example

cellattr: function () { return ' title="my custom fixed tooltip for the column"'; }



回答3:


This can achieve by 2 steps

  1. You can simply disable the default tool tip by setting title:false
  2. write a global function and attached as a formatter in colModel

    var changeTitle = function(cellVal, options, rowObject){<br/>
        return  "&lt;div title='This is the cell value " + cellVal + "'>" + cellVal + "&lt;/div>";<br/>
    }
    
    colModel:[
    {...},<br/>
     {name:'priorityFlag', index:'priorityFlag', width:40, align:"center", formatter:   changeTitle },<br/>
    {...}]
    

There you go!...




回答4:


  • You can right click title
  • Learn a column ID name ex:PersonelGrid_DefViewMainPage
  • Set you after grid load this code..

    $("#PersonelGrid_DefViewMainPage").attr("title", "This is my Title.");

it's work..



来源:https://stackoverflow.com/questions/4749874/jqgrid-change-column-title-attribute

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!