项目中需要在treegrid中显示的内容上,鼠标移到这个内容处,用一个提示信息的方式显示,如图所示,实现此功能,只需要在jquery.easyui.min.js文件中在方法
function _546(row,_547,_548,_549)中添加一句
_54a.push("title=\""+row[_54b]+"\"");/*add title tips*/。
以下代码是此treegrid。
row中存放的是返回到前台的所有信息,,_54的值是columns中的field。
$('#taskInfo').treegrid({ title:'任务列表', width:allWidth, height:450, nowrap: true, rownumbers: true, animate:false, fitColumns:true, collapsible:true, loadMsg:'正在加载数据,请稍后...', url:encodeURI('../getTaskInfo.htm?chargeHumanName='+chargeHumanName+'&taskDate='+date), idField:'taskID', treeField:'taskName', frozenColumns:[[ {title:'任务',field:'taskName',width: parseInt(0.15*allWidth),editor:'text'} ]], columns:[[ {field:'taskDescription',title:'描述',width: parseInt(0.18*allWidth)}, {field:'chargeHumanName',title:'负责人',width: parseInt(0.06*allWidth)}, {field:'startDate',title:'起始时间',width: parseInt(0.08*allWidth)}, {field:'endDate',title:'结束时间',width: parseInt(0.08*allWidth)}, {field:'dayNum',title:'天数',width: parseInt(0.04*allWidth)}, {field:'priority',title:'优先级',width: parseInt(0.05*allWidth)}, {field:'finishDegree',title:'完成度(%)',width: parseInt(0.06*allWidth)}, {field:'remark',title:'备注',width: parseInt(0.26*allWidth)} ]], toolbar:[{ text:'增加', iconCls:'icon-add', handler:function(){ addTask(); } },'-',{ text:'编辑', iconCls:'icon-edit', handler:function(){ editor(); } },'-',{ text:'删除', iconCls:'icon-remove', handler:function(){ remove(); } },'-',{ text:'取消', iconCls:'icon-undo', handler:function(){ cancelSelected(); } }], onBeforeLoad:function(row,param){ $(this).treegrid('options').url = encodeURI('../getTaskInfo.htm?chargeHumanName='+chargeHumanName+'&taskDate='+date); }, onContextMenu: function(e,row){ e.preventDefault(); $(this).treegrid('unselectAll'); $(this).treegrid('select', row.taskID); $('#menu').menu('show', { left: e.pageX, top: e.pageY }); } }); }