Is there any function in jquery grid which allow only single row edit at a time? Currently we can edit multiple rows.
在jquery网格中是否有任何函数一次只允许单行编辑?目前我们可以编辑多行。
1 个解决方案
#1
2
The above query is posted by my colleague. We are using the below code.
以上查询由我的同事发布。我们正在使用以下代码。
We are using Jquery.jqgrid-4.1.2.min.js
我们正在使用Jquery.jqgrid-4.1.2.min.js
Scenario is : It is allowing us to edit more then one rows simultaneously, but as soon as the cursor moves on another row, save and cancel buttons for the first row is still there
场景是:它允许我们同时编辑多行,但是一旦光标在另一行上移动,第一行的保存和取消按钮仍然存在
$("#AllocationsGrdList").jqGrid({
url: '@Url.Action("ActionName", "Controller")/',
datatype: "json",
colNames: ['Category Name','Amount','Edit'],
colModel: [
{ name: 'CategoryName', index: 'CategoryName', sortable: true, sorttype: 'text', width: 140, classes: 'bStyle' },
{
name: 'Amount', index: 'Amount', width: 82, align: "right", editable: true, editrules: { number: true, required: true, custom: true, custom_func: Deductions }, formatter: 'currency',
formatoptions: { decimalSeparator: ".", thousandsSeparator: ",", decimalPlaces: 2, defaultValue: '0.00', prefix: '$ ' },
editoptions: {
style: 'width:70px;', dataEvents: [
{
type: 'blur',
fn: function (e) {
CalculateDeductions($(this).val());// SOme DB Operation
}
}
]
}
},
{
name: 'act', index: 'act', width: 60, align: 'center', sortable: false, formatter: 'actions',
formatoptions: {
keys: false,
delbutton: false,
onEdit: function (rowid) {
},
onSuccess: function (jqXHR) {
$("#AllocationsGrdList").trigger('reloadGrid');
return true;
},
onError: function (rowid, jqXHR, textStatus) {
},
afterSave: function (rowid) {
},
afterRestore: function (rowid) {
$("#AllocationsGrdList").trigger('reloadGrid');
}
}
}
],
rowNum: 10, rowList: [10, 20, 30],
sortname: 'CategoryName',
shrinkToFit: true,
sortable: true,
viewrecords: true,
sortorder: "desc",
footerrow: true,
width: '780',
height: '100%',
jsonReader:
{
root: 'List',
page: 'Page',
total: 'TotalPages',
records: 'TotalCount',
repeatitems: false,
id: 'Id'
},
editurl: '@Url.Action("ActionName", "ControllerName")'
});
#1
2
The above query is posted by my colleague. We are using the below code.
以上查询由我的同事发布。我们正在使用以下代码。
We are using Jquery.jqgrid-4.1.2.min.js
我们正在使用Jquery.jqgrid-4.1.2.min.js
Scenario is : It is allowing us to edit more then one rows simultaneously, but as soon as the cursor moves on another row, save and cancel buttons for the first row is still there
场景是:它允许我们同时编辑多行,但是一旦光标在另一行上移动,第一行的保存和取消按钮仍然存在
$("#AllocationsGrdList").jqGrid({
url: '@Url.Action("ActionName", "Controller")/',
datatype: "json",
colNames: ['Category Name','Amount','Edit'],
colModel: [
{ name: 'CategoryName', index: 'CategoryName', sortable: true, sorttype: 'text', width: 140, classes: 'bStyle' },
{
name: 'Amount', index: 'Amount', width: 82, align: "right", editable: true, editrules: { number: true, required: true, custom: true, custom_func: Deductions }, formatter: 'currency',
formatoptions: { decimalSeparator: ".", thousandsSeparator: ",", decimalPlaces: 2, defaultValue: '0.00', prefix: '$ ' },
editoptions: {
style: 'width:70px;', dataEvents: [
{
type: 'blur',
fn: function (e) {
CalculateDeductions($(this).val());// SOme DB Operation
}
}
]
}
},
{
name: 'act', index: 'act', width: 60, align: 'center', sortable: false, formatter: 'actions',
formatoptions: {
keys: false,
delbutton: false,
onEdit: function (rowid) {
},
onSuccess: function (jqXHR) {
$("#AllocationsGrdList").trigger('reloadGrid');
return true;
},
onError: function (rowid, jqXHR, textStatus) {
},
afterSave: function (rowid) {
},
afterRestore: function (rowid) {
$("#AllocationsGrdList").trigger('reloadGrid');
}
}
}
],
rowNum: 10, rowList: [10, 20, 30],
sortname: 'CategoryName',
shrinkToFit: true,
sortable: true,
viewrecords: true,
sortorder: "desc",
footerrow: true,
width: '780',
height: '100%',
jsonReader:
{
root: 'List',
page: 'Page',
total: 'TotalPages',
records: 'TotalCount',
repeatitems: false,
id: 'Id'
},
editurl: '@Url.Action("ActionName", "ControllerName")'
});