jQuery   发布时间:2022-04-19  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了jquery – 如何在jqgrid中的动作按钮之前添加按钮大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
Custom jQGrid post action中的答案使用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"));
    });
}

相应的demo显示

我另外添加了CSS

.ui-inline-custom.ui-state-hover span { margin: -1px; }

对于悬停的小改进,对应于已在jqGrid 4.3.2中实现的the bug fix.

更新:当前版本的free jqGrid支持简单的方法来实现自定义按钮.见the demo.

大佬总结

以上是大佬教程为你收集整理的jquery – 如何在jqgrid中的动作按钮之前添加按钮全部内容,希望文章能够帮你解决jquery – 如何在jqgrid中的动作按钮之前添加按钮所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。