Anto king
Anto king

Reputation: 1222

How to disable enter key in JQGrid Edit?

I've using JQgrid, and using inline edit all working fine but i need to disable the enter key press. Means if user entering values and click enter it not need to do any action. Now its trying to store the data as per edit url. But i don't need this functionality.

Just Disable enter key press on JQGrid. Can any one help?

Hi Oleg As u asked i'm pasting my code its bit lengthy so i'm posting part which needed.

$("#RevenueReporttbl").jqGrid({
                contentType: "application/json; charset=utf-8",
                mtype: 'GET',
                //                    url: '/AMForecast/Index/',
                height: 'auto',
               // width: 'auto',
                   width: '1150',
                gridview: true,
                datatype: "local",
                loadonce: true,
                data: search_result,
                colNames: ['ForecastId', 'CustomerId', 'Customer Name', 'UserId', 'Person', 'ProjectId', 'Project Name', 'Edit', 'Ytd'],

                colModel: [
                    { name: 'ForecastId', index: 'ForecastId', editable: false, sortable: false, hidden: true, fixed: true },
                    { name: 'CustomerId', index: 'CustomerId', editable: false, sortable: false, hidden: true, fixed: true },
                    { name: 'CustomerName', index: 'CustomerName', width: 130, editable: false, sortable: false, fixed: true },
                    { name: 'UserId', index: 'UserId', width: 130, editable: false, sortable: false, hidden: true, fixed: true },
                    { name: 'Manager', index: 'Manager', align: 'left', width: 130, editable: false, sortable: false, fixed: true },
                    { name: 'ProjectId', index: 'ProjectId', editable: false, sortable: false, hidden: true, fixed: true },
                    { name: 'ProjectName', index: 'ProjectName', editable: false, sortable: false, hidden: true, fixed: true },
                    { name: 'Edit', index: 'Edit', editable: false, width: 40, align: 'center', hidden: false, sortable: false, fixed: true },

                    { name: 'Ytd', index: 'Ytd', editable: false, width: 40, align: 'right', sortable: false, summaryType: 'sum', fixed: true }],
                     rowNum: 99,
                pager: '#pager',
                footerrow: true,
                userDataOnFooter: true,
                altRows: false,
                rowList: [100, 200, 300, 400, 500],
                multipleSearch: true,
                //multiselect: true,
                multipleGroup: true,
                shrinkToFit: true,
                viewrecords: true,
                sortorder: "desc",
                subGrid: true,
                grouping: true, //changed
                groupingView: {
                    groupField: ['CustomerType'],
                    groupSummary: [true],
                    groupColumnShow: [false],
                    groupText: ['<b>{0}</b>'],
                    groupCollapse: false,
                    groupOrder: ['asc'],
                    groupDataSorted: true
                 },
                jsonReader: {
                    root: "gridModel",
                    page: "page",
                    total: "total",
                    records: "records",
                    repeatitems: false,
                    cell: "cell",
                    id: "id",
                    subgrid: {
                        root: "gridModel",
                        repeatitems: true,
                        cell: "cell",
                        id: "id"
                    }
                }

So i'm using subgrid also with read only option. Please tell how to make enter key false? I dont want to do anything when i clicked enter in edit mode.

Upvotes: 2

Views: 5173

Answers (1)

Dave L.
Dave L.

Reputation: 9781

Did you see the part of the docs about the keys setting:

http://www.trirand.com/jqgridwiki/doku.php?id=wiki:inline_editing

It says:

If keys is true, then the remaining settings – successfunc, url, extraparam, aftersavefunc, errorfunc and afterrestorefunc - are passed as parameters to the saveRow method when the [Enter] key is pressed (saveRow does not need to be defined as jqGrid calls it automatically). For more information see saveRow method below.

Upvotes: 3

Related Questions