自定义jQGrid后期操作中的答案使用appendTo()将自定义按钮添加到操作结束按钮.
如何为动作按钮添加按钮?
我试图用before()和prepend()替换appendTo()但是在这个按钮中消失.
我尝试使用prependTo而不是appendTo所有的作品.准确地说我用过
loadComplete: function () {
var iCol = getColumnIndexByName(grid, 'act');
$(this).find(">tbody>tr.jqgrow>td:nth-child(" + (iCol + 1) + ")")
.each(function() {
$("<div>", {
title: "Custom",
mouseover: function() {
$(this).addClass('ui-state-hover');
},
mouseout: function() {
$(this).removeClass('ui-state-hover');
},
click: function(e) {
alert("'Custom' button is clicked in the rowis="+
$(e.target).closest("tr.jqgrow").attr("id") +" !");
}
}
).css({"margin-right": "5px", float: "left", cursor: "pointer"})
.addClass("ui-pg-div ui-inline-custom")
.append('<span class="ui-icon ui-icon-document"></span>')
.prependTo($(this).children("div"));
});
}
Run Code Online (Sandbox Code Playgroud)
相应的演示显示

我另外添加了CSS
.ui-inline-custom.ui-state-hover span { margin: -1px; }
Run Code Online (Sandbox Code Playgroud)
对于悬停的小改进,对应于已在jqGrid 4.3.2中实现的错误修复.
更新:当前版本的免费jqGrid支持简单的方法来实现自定义按钮.看演示.
| 归档时间: |
|
| 查看次数: |
9604 次 |
| 最近记录: |