Flexigrid表:如何在表格单元格数据中添加工具提示

时间:2014-03-11 09:08:52

标签: javascript jquery tooltip flexigrid

我给表头提供了工具提示,如: 添加if( cm.title != undefined ) {$(th).attr('title', cm.title);} 在col model itreration下的flexgrid.js文件中

if (p.colModel) {
        thead = document.createElement("thead");
        var tr = document.createElement("tr");
        for (var i = 0; i < p.colModel.length; i++) {
            var cm = p.colModel[i];
            var th = document.createElement("th");
            th.innerHTML = cm.display;
            if( cm.title != undefined ) {$(th).attr('title', cm.title);}
            if (cm.name && cm.sortable)
                $(th).attr("abbr", cm.name);
            $(th).attr("axis", "col" + i);
            if (cm.align)
                th.align = cm.align;
            if (cm.width)
                $(th).attr("width", cm.width);
            if ($(cm).attr("hide"))
                th.hidden = true;
            if (cm.process)
                th.process = cm.process;
            $(tr).append(th)
        }
        $(thead).append(tr);
        $(t).prepend(thead)
    }

并使用Like:

colModel : [
                { display: 'Tender No', title: 'tbgNo', name : 'tbgNo', width : 200, sortable : true, align: 'left',}

那么,我们如何向Table cell添加工具提示./

2 个答案:

答案 0 :(得分:0)

您可以使用element.setAttribute("title","message tool-tip you want");

答案 1 :(得分:0)

R&amp; D lot我找到了一个最好的结果,它可以在所有情况下工作。 我们可以通过在填充网格的位置使用span title来向flexgrid单元格提供工具提示 请查看此代码。

if(!(jsonobj ==null)){
                for(var i=0; i < jsonobj.list.length; i++){
                rows.push({  cell: 
                    [
                     "<span title='"+jsonobj.list[i].tbgNo+"'>"+checkforUndefined(jsonobj.list[i].tbgNo)+"</span>",
                     "<span title='"+jsonobj.list[i].title+"'>"+"<A HREF=javascript:showCodes("
                        + jsonobj.list[i].id
                        + ")>"
                        + jsonobj.list[i].title
                        + "</A> "+"</span>",
                        checkforUndefined(jsonobj.list[i].startDate)
                    ] 
                });
                } 

谢谢..

相关问题