jQgrid:如何在添加/编辑对话框中灰显禁用的字段?

时间:2014-08-20 20:17:06

标签: jqgrid

我发现以下链接可以帮助我清除readonly字段。 jqGrid: How to grey out read only fields on add/edit form dialog?

但我正在寻找可以帮助我清除禁用字段的东西。

关于如何让这个工作的任何想法?

编辑添加代码以更好地解释我的情况。我下面的所有示例都使用了上面链接中的灰色代码。

这第一段代码与上面链接上的解决方案完美配合,使readonly部分变灰。但我们必须将其更改为选择列表。

            //
            // This grays out the field name and the input field.  (But this had to be changed to a selection list for business reasons)
            //
            //{ name: 'tCode', index: 'tCode', width: 63, align: "left", editable: true, editoptions: { maxlength: "25", readonly: istCodeReadOnly } },

下一段代码会使选择变灰,但不会显示旁边的字段名称。

// This grays out the selection but not the field name { name: 'tCode', index: 'tCode', width: 63, align: "left", editable: true, editrules: { required: true }, edittype: "select", editoptions: { disabled: istCodeReadOnly, async: false, dataUrl: '@Url.Action("GettCodes", "Home")', buildSelect: function (result) { var response = $.parseJSON(result); var s = '<select>'; $.each(response, function () { s += "<option value='" + this.code + "' > " + this.description + "</option>"; }); return s + "</select>"; } } },

这是第一次没有任何灰色的尝试。它像readonly领域从未被认可。基本上没有任何反应。

            // This does not gray out the field name or the field itself
            {
                name: 'tCode', index: 'tCode', width: 63, align: "left", editable: true, editrules: { required: true }, edittype: "select", editoptions: {
                    readonly: istCodeReadOnly,
                    async: false, dataUrl: '@Url.Action("GettCodes", "Home")',
                    buildSelect: function (result) {
                        var response = $.parseJSON(result);
                        var s = '<select>';
                        $.each(response, function () {
                            s += "<option value='" + this.code + "' > " + this.description + "</option>";
                        });
                        return s + "</select>";
                    }
                }
            },

0 个答案:

没有答案