显示/隐藏 jqgrid 删除按钮

发布于 2024-12-09 15:25:19 字数 3214 浏览 0 评论 0 原文

我想根据 jqGrid 中的特定数据显示/隐藏 jqgrid 删除按钮。

 $('#jqgFlagger').jqGrid('navGrid', '#jqgpFlagger',
            { add: false, del: false, edit: false, search: false },
            { width: 'auto', url: '/DtlmTransaction/UpdateRole' },
            { width: 'auto', url: '/DtlmTransaction/InsertRole' },
            { width: 'auto', url: '/DtlmTransaction/DeleteMultiple' });

上面的代码显示我没有使用 jqgrid 自己的删除选项,而是使用操作中的自定义删除选项,如下所示;

 colModel: [
                    { name: 'FlaggerName', resizable: false, index: 'FlaggerName', align: 'left', width: 312, editable: false },
                    { name: 'DataFileReceived', formatter: DataFileReceivedFormatter, resizable: false, index: 'DataFileReceived', width: 130, align: 'left', search: false, edittype: 'text' },
                    { name: 'ProcessStartDate', formatter: ProcessStartDateFormatter, resizable: false, index: 'ProcessStartDate', width: 130, align: 'left', align: 'left', search: false, edittype: 'text' },
                    { name: 'ProcessCompleteDate', formatter: ProcessCompleteDateFormatter, resizable: false, index: 'ProcessCompleteDate', width: 150, align: 'left', search: false, edittype: 'text' },
                    { name: 'Total', resizable: false, index: 'Total', width: 53, align: 'center', search: false },
                    { name: 'Identical', resizable: false, index: 'Identical', width: 53, align: 'center', search: false },
                    { name: 'Differences', resizable: false, index: 'Differences', width: 51, align: 'center', search: false },
                    { name: 'StateAbri', resizable: false, index: 'StateId', width: 48, align: 'left' },
                    { name: 'CountyName', resizable: false, index: 'CountyName', width: 86, align: 'left' },
                    { name: 'Name', resizable: false, index: 'ServiceName', align: 'left', width: 127 },
                    { name: 'StatusName', formatter: statusFormatter, resizable: false, index: 'StatusId', align: 'center', width: 70, search: false },
                    { name: 'StatusColor', hidden: true, resizable: false, index: 'StatusColor', align: 'left', width: 70, search: false },
                    { name: 'bitDefault', formatter: bitDefaultFormatter, resizable: false, index: 'bitDefault', align: 'left', width: 40, search: false, editoptions: { value: '1:0' }, editable: false, edittype: 'checkbox' },
                    { name: 'Names', resizable: false, index: 'Names', align: 'left', width: 100,
                        search: false, sortable: false, formatter: editFmatter
                    },
                    { name: 'act', index: 'act', width: 50, align: 'center', sortable: false, formatter: 'actions',
                        formatoptions: {
                            keys: true,
                            editformbutton: false,
                            delbutton: true,
                            editbutton: false,
                            delOptions: { url: '/DtlmTransaction/DeleteMultiple' }
                        }
                    }],

在这里您可以看到我已启用 delButton:true。现在我想在 jqgrid 行的字段数据条件上显示/隐藏删除按钮。例如,如果我获取该行的字段值(成功、完成等),那么我想隐藏此按钮。我该怎么做?请建议。

I want to show/hide jqgrid delete button on the basis of specific data in jqGrid.

 $('#jqgFlagger').jqGrid('navGrid', '#jqgpFlagger',
            { add: false, del: false, edit: false, search: false },
            { width: 'auto', url: '/DtlmTransaction/UpdateRole' },
            { width: 'auto', url: '/DtlmTransaction/InsertRole' },
            { width: 'auto', url: '/DtlmTransaction/DeleteMultiple' });

Above is the code that shows that I'm not using jqgrid own delete option but the custom delete option from the action which is as under;

 colModel: [
                    { name: 'FlaggerName', resizable: false, index: 'FlaggerName', align: 'left', width: 312, editable: false },
                    { name: 'DataFileReceived', formatter: DataFileReceivedFormatter, resizable: false, index: 'DataFileReceived', width: 130, align: 'left', search: false, edittype: 'text' },
                    { name: 'ProcessStartDate', formatter: ProcessStartDateFormatter, resizable: false, index: 'ProcessStartDate', width: 130, align: 'left', align: 'left', search: false, edittype: 'text' },
                    { name: 'ProcessCompleteDate', formatter: ProcessCompleteDateFormatter, resizable: false, index: 'ProcessCompleteDate', width: 150, align: 'left', search: false, edittype: 'text' },
                    { name: 'Total', resizable: false, index: 'Total', width: 53, align: 'center', search: false },
                    { name: 'Identical', resizable: false, index: 'Identical', width: 53, align: 'center', search: false },
                    { name: 'Differences', resizable: false, index: 'Differences', width: 51, align: 'center', search: false },
                    { name: 'StateAbri', resizable: false, index: 'StateId', width: 48, align: 'left' },
                    { name: 'CountyName', resizable: false, index: 'CountyName', width: 86, align: 'left' },
                    { name: 'Name', resizable: false, index: 'ServiceName', align: 'left', width: 127 },
                    { name: 'StatusName', formatter: statusFormatter, resizable: false, index: 'StatusId', align: 'center', width: 70, search: false },
                    { name: 'StatusColor', hidden: true, resizable: false, index: 'StatusColor', align: 'left', width: 70, search: false },
                    { name: 'bitDefault', formatter: bitDefaultFormatter, resizable: false, index: 'bitDefault', align: 'left', width: 40, search: false, editoptions: { value: '1:0' }, editable: false, edittype: 'checkbox' },
                    { name: 'Names', resizable: false, index: 'Names', align: 'left', width: 100,
                        search: false, sortable: false, formatter: editFmatter
                    },
                    { name: 'act', index: 'act', width: 50, align: 'center', sortable: false, formatter: 'actions',
                        formatoptions: {
                            keys: true,
                            editformbutton: false,
                            delbutton: true,
                            editbutton: false,
                            delOptions: { url: '/DtlmTransaction/DeleteMultiple' }
                        }
                    }],

Here you can see that in action i've enable delButton:true. Now i want to show/hide delete button on the jqgrid row's field data condtion. For example if i get the row's field value (success,complete, etc) then i want to hide this button. How can i do it? Please suggest.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抱着落日 2024-12-16 15:25:19

Look at the demo from the answer. One more option is to disable navigator buttons based on the selected row like it shows in the demo from another old answer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文