显示/隐藏jqgrid删除按钮

时间:2011-10-12 05:18:36

标签: jqgrid jqgrid-asp.net jqgrid-formatter

我想基于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行的字段数据条件上显示/隐藏删除按钮。例如,如果我得到行的字段值(成功,完成等),那么我想隐藏此按钮。我该怎么做?请建议。

1 个答案:

答案 0 :(得分:3)

查看the answer的演示。还有一个选项是禁用基于所选行的导航按钮,就像它从另一个the demo old answer中显示的一样。