English 中文(简体)
jqGrid navigator - how to specyfy settings globally?
原标题:

I m using Navigator with jqGrid and I m repeating over and over settings such as:

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

How can I define these settings globally to all my grids on current page?

I know how to specyfiy jqGrid settings globally, but I have problems with Navigator. My sample Navigator definition looks like this:

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

问题回答

暂无回答




相关问题
Retrieving original row data from jqGrid

It is possible to use the getRowData method to retrieve the current of a cell but this retrieves the current cell content rather than the original data before it went through the formatter. How do I ...

How to programmatically select top row of JQGrid?

How does one programmatically select the top row of a JQGrid. I want to have the top row already selected when it is opened on the page. My grid is sorted by a descriptive column so the first row s id ...

Blank when NaN in jqGrid cells

How to set blank instead of NaN in jqGrid cells ? Using formatter ? Is there an example?

complete jqGrid?

Please, can anyone tell me how to use jqGrid? I want to do edit, add & delete functionality. Also I want to show an image in the grid Please tell me, what can I do, and how can I do?

jqGrid: is there an event for when columns are reordered?

I m using the column reordering feature in jqGrid $grid = jQuery("#list").jqGrid({ sortable:true, ... }); Is there an event that fires after columns are re-ordered? If there is, I can t see ...

Wrapping Text lines in JqGrid

Can you get lines of text to wrap in JqGrid? I have had a look round but i can t find anything.

using jqgrid style for usual Table in asp.net mvc

I d prefer using Table and td instead of JqGrid but i like JqGrid styles. has anyone used jqgrid style for usual Grid of asp.net MVC(i mean Table and td) before?

热门标签