添加自定义按钮到jqGrid的ColumnChooser对话 [英] Add custom button into jqGrid ColumnChooser dialog

查看:2041
本文介绍了添加自定义按钮到jqGrid的ColumnChooser对话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加自定义按钮到ColumnChooser对话框并使其表现得像其他人。我试图得到类似这个(默认按钮)

  _this.table.jqGrid(navButtonAdd,_this.pid,{
    标题:,
    buttonicon:图标,
    标题:标题,
    onClickButton:功能(){
      返回self.table.jqGrid(columnChooser,{
        完成:功能(烫){
          如果(烫发){
            self.table.jqGrid(remapColumns,烫发,真正的);
            返回$(窗口).triggerHandler(resize.jqGrid);
          }
        },
        dialog_opts:{
          模式:真实,
          可调整大小:假的
        },
        msel_opts:{
          dividerLocation:0.5
        },
        宽度:460
      });    }
  });


解决方案

您可以通过以下方式做到这一点:

  onClickButton:功能(){
    $(本).jqGrid(columnChooser,{
        dialog_opts:{
            纽扣: {
                默认值:函数(){
                    警报(默认按钮被点击!);
                }
            }
        }
    });
}

相应演示显示下列结果:

在这里输入的形象描述

i want to add custom button into ColumnChooser dialog box and make it to behave like others. I try to get something like this(Default button)

  _this.table.jqGrid("navButtonAdd", _this.pid, {
    caption: "",
    buttonicon: "icon",
    title: "Title",
    onClickButton: function() {
      return self.table.jqGrid("columnChooser", {
        done: function(perm) {
          if (perm) {   
            self.table.jqGrid("remapColumns", perm, true);
            return $(window).triggerHandler("resize.jqGrid");
          }
        },
        dialog_opts: {
          modal: true,
          resizable: false
        },
        msel_opts: {
          dividerLocation: 0.5
        },
        width: 460
      });

    }
  });

解决方案

You can do this in the following way:

onClickButton: function () {
    $(this).jqGrid("columnChooser", {
        dialog_opts: {
            buttons: {
                Default: function () {
                    alert("Default button is clicked!");
                }
            }
        }
    });
}

The corresponding demo displays the following results:

这篇关于添加自定义按钮到jqGrid的ColumnChooser对话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆