Question

J'utilise Navigator avec jQgrid et je répète des paramètres de plus de détails tels que:

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

Comment puis-je définir ces paramètres globalement à toutes mes grilles sur la page actuelle?

Je sais que SPECYFIY JQGRID paramètres globalement, mais j'ai des problèmes avec Navigator. Ma définition de navigateur d'échantillon ressemble à ceci:

    $("#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
        }
    );

Était-ce utile?

La solution

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)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top