如何在JQGrid Edit中禁用enter键?

时间:2013-03-28 13:41:37

标签: jqgrid

我使用JQgrid,并使用内联编辑所有工作正常,但我需要禁用回车键按。表示如果用户输入值并单击输入则不需要执行任何操作。现在它尝试按编辑网址存储数据。但我不需要这个功能。

只需在JQGrid上按Enter键按下即可。 任何人都可以帮忙吗?

嗨Oleg正如你所说,我将我的代码粘贴得有点冗长,所以我发布了需要的部分。

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

所以我也使用subgrid和read only选项。 请告诉我如何让输入密钥错误?当我点击进入编辑模式时,我不想做任何事情。

1 个答案:

答案 0 :(得分:3)

您是否看到了有关keys设置的文档部分:

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

它说:

  

如果键为true,则剩余设置 - successfunc,url,   extraparam,aftersavefunc,errorfunc和afterrestorefunc - 被传递   按下[Enter]键时作为saveRow方法的参数   (saveRow不需要定义为jqGrid调用它   自动)。有关更多信息,请参阅下面的saveRow方法。

相关问题