我正在使用 navigator jqgrid ,我在和过度上重复:

savekey: [true, 13],
closeOnEscape: true,
closeAfterAdd: true
.

如何将全局定义这些设置,以在当前页面上的所有网格上?

我知道如何在全球范围内拼写jqgrid设置,但我对导航器有问题。 我的示例导航器定义如下所示:

    $("#dictionaryElementsGrid").navGrid(
        "#dictionaryElementsPager",
        {
            search: false,
            edit: true,
            add: true,
            del: true
        },
        {
            // Edit options:
            savekey: [true, 13],
            closeOnEscape: true,
            closeAfterEdit: true
        },
        {
            // Create options:
            savekey: [true, 13],
            closeOnEscape: true,
            closeAfterAdd: true
        }
    );
.

有帮助吗?

解决方案

The object jQuery.jgrid.edit is responsible for the default setting of Add and Edit forms, so you can include in your common JavaScript code the following:

jQuery.extend(jQuery.jgrid.edit, {
    savekey: [true, 13],
    closeOnEscape: true,
    closeAfterEdit: true,
    closeAfterAdd: true,
    recreateForm: true
});

The recreateForm:true option is another option which I recommend you to use if you use some events in the Edit or Add form.

Another settings jQuery.jgrid.nav, jQuery.jgrid.del, jQuery.jgrid.view and of course jQuery.jgrid.defaults can be also helpful and can be used in the same way as jQuery.jgrid.edit above. For example,

jQuery.extend(jQuery.jgrid.nav, {search: false});

The settings edit:true, add:true, del:true are already default (see the source code of navGrid)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top