【发布时间】:2013-10-30 20:20:48
【问题描述】:
基本上我有一个 Kendo Grid,其中我的几个专栏也有 Kendo DropDowns。 我想根据用户从“仪器”下拉列表中选择的值附加一个工具提示。
这是我的网格 javascript 代码(使用 MVVM 模式):
tradesGrid = $("#tradesGrid").kendoGrid({
dataSource: datasource,
toolbar: [
{ name: "create", text: "Add Trade" }
],
columns: [{
field: "TradeId"
},
{
field: "Instrument",
editor: instrumentsDropDownEditor, template: "#=Instrument#"
},
{ command: ["edit", "destroy"] },
],
sortable: true,
editable: "popup",
});
这里是仪器下拉菜单的编辑器功能:
function instrumentsDropDownEditor(container, options) {
var instrItems = [{
"optionInstr": "OPTION 22/11/2013 C70 Equity"
}, {
"optionInstr": "OPTION 26/11/2013 C55 Equity"
},
{
"optionInstr": "OPTION 30/11/2013 C80 Equity"
}
];
var input = $('<input id="Instrument" name="Instrument">');
input.appendTo(container);
input.kendoDropDownList({
dataTextField: "optionInstr",
dataValueField: "optionInstr",
dataSource: instrItems, // bind it to the brands array
optionLabel: "Choose an instrument"
}).appendTo(container);
}
在我的 Html 视图文件中,我从这个想法开始:
<span class="key-button"
title="Instrument Details!!!"
data-role="tooltip"
data-auto-hide="true"
data-position="right"
data-bind="events: { show: onShow, hide: onHide }"
</span>
【问题讨论】:
-
您可能能够通过将 jquery 鼠标悬停在事件 api.jquery.com/mouseover 上来实现您正在寻找的东西。我对工具提示知之甚少,但我认为必须事先定义,因此您可能不得不伪造它并显示样式叠加或类似的东西
-
有用的 jquery 文档。我会考虑这个解决方案,谢谢。
标签: html asp.net-mvc-4 mvvm kendo-ui