简体   繁体   English

如何在jqgrid的格式化区域之外显示单元格内容的正确工具提示

[英]How to show proper tooltip for cell content outside formatted area in jqgrid

Select element is added to jqgrid column using code below. 使用以下代码将Select元素添加到jqgrid列。 If cursor is over margin area in cell (between select element and cell border), strange tooltip containing all discounts (select element content rendered as text) appears. 如果光标在单元格的空白区域上方(在选择元素和单元格边界之间),则会出现奇怪的工具提示,其中包含所有折扣(以文本形式显示的选择元素内容)。

"title":"Click in combo to select discount"

is ignored and never shown. 被忽略,从不显示。 How to show tooltip "Click in combo to select discount" in this case ? 在这种情况下,如何显示工具提示“单击组合以选择折扣”? If mouse is hover select element proper tooltip "Select discount by clicking here" appears. 如果将鼠标悬停在选择元素上,则会出现正确的工具提示“通过单击此处选择折扣”。

colmodel: 型号:

{"formatter":discountFormatter
 "name":"Discount",
 "title":"Click in combo to select discount",
 "width":50
}


var discount = '<select style="width:100%" title="Select discount by clicking here" onchange="discountOnChange(this)">', i;
for (i = 0; i <= 50; i++) {
    discount += '<option value="' + i.toString() + '">' + i.toString() + '%</option>';
}
discount += '</select>';

function discountFormatter() {
    return discount;
}

If you want that tooltip will be displayed on the whole cell you should set title attribute on the cell ( <td> ) instead of setting it only on <select> . 如果希望该工具提示显示在整个单元格上,则应在单元格( <td> )上设置title属性,而不是仅在<select>上设置它。 sellattr is the best to do this: sellattr是执行此操作的最佳方法:

cellattr: function () { return ' title="Click in combo to select discount"'; }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM