禁用jqgrid的编辑(添加,编辑和删除)按钮,而不是隐藏(默认行为) [英] Disable edit(add, edit and delete) buttons of jqgrid instead of hiding(default behaviour)

查看:511
本文介绍了禁用jqgrid的编辑(添加,编辑和删除)按钮,而不是隐藏(默认行为)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,Jqgrid使用值为false的适当属性使添加,编辑和删除按钮隐藏. (例如,以导航网格或其他方式{{添加:false,false,del:false}).

Jqgrid by default make add, edit and delete buttons hidden on using appropriate properties with value as false. (ex: {add: false, edit: false, del: false} in nav grid or the other way).

在这里,我想禁用这些按钮而不是隐藏它们.任何人都可以帮忙.我的意思是说,要将隐藏的默认功能更改为禁用.

Here, I want to disable these buttons instead of hiding. Can anyone help on this. I mean to say is, want to change the default functionality of hiding to disabling.

谢谢.

推荐答案

旧答案描述了如何实现行为,这是您需要的.

The old answer describes how one could implement the behavior, which you need.

首先,重要的是要知道导航器栏上所有按钮的ID,这些ID需要禁用.根据您使用(可以使用)的jqGrid版本以及jqGrid的分支(免费jqGrid ,商业 Guriddo jqGrid JS 或旧的版本< = 4.7中的jqGrid).我开发了免费jqGrid ,如果您没有的话,我建议您使用它任何特殊限制.顶部和底部寻呼机的ID不同(请参见jqGrid的pagertoppager选项).您只需使用开发者工具来检查需要禁用的按钮的ID.

First of all it's important that you know ids of all buttons of the navigator bar, which you need to disable. The rules of id building could be a little different depend on the version of jqGrid, which you use (can use) and from the fork of jqGrid (free jqGrid, commercial Guriddo jqGrid JS or an old jqGrid in version <=4.7). I develop free jqGrid, which I would recommend you to use it, if you don't have any special restrictions. The ids are different for top and bottom pagers (see pager and toppager options of jqGrid). You can just use Developer Tools to examine the ids of the buttons, which you need to disable.

重要的是要理解,在每次选择/取消选择行后,都应更新导航器按钮的状态(禁用/启用).因此,您应该使用beforeSelectRow回调或jqGridBeforeSelectRow事件.要在使用jQuery UI CSS的情况下禁用按钮,则应将CSS类ui-state-disabledui-jqgrid-disablePointerEvents添加到按钮中,要启用,应删除这些类.如果使用Bootstrap CSS而不是jQuery UI CSS,则应使用"disabled ui-jqgrid-disablePointerEvents"而不是"ui-state-disabled ui-jqgrid-disablePointerEvents".类ui-jqgrid-disablePointerEvents在免费jqGrid的ui.jqgrid.css(ui.jqgrid.min.css)中定义.如果您不使用免费的jqGrid,则应通过以下方式进行定义:

It's important to understand, that you should update the state (disable/enable) of navigator buttons after every selection/deselection of rows. Thus you should use beforeSelectRow callback or jqGridBeforeSelectRow event. To disable the button in case of usage jQuery UI CSS you should add CSS classes ui-state-disabled and ui-jqgrid-disablePointerEvents to the buttons and to enable, you should remove the classes. If you use Bootstrap CSS instead of jQuery UI CSS, then you should use "disabled ui-jqgrid-disablePointerEvents" instead of "ui-state-disabled ui-jqgrid-disablePointerEvents". The class ui-jqgrid-disablePointerEvents is defined in ui.jqgrid.css (ui.jqgrid.min.css) of free jqGrid. If you don't use free jqGrid then you should define it in the following way:

.ui-jqgrid-disablePointerEvents {
    pointer-events: none;
}

(请参见 ui.jqgrid.css的代码行).如果要支持几乎所有的Web浏览器,则pointer-events: none的用法很重要(请参阅

(see the lines of the code of ui.jqgrid.css). The usage of pointer-events: none is important if you want to support mostly all web browsers (see here) on different devices.

这篇关于禁用jqgrid的编辑(添加,编辑和删除)按钮,而不是隐藏(默认行为)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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