Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
142698 | Feb 15,2019 11:42 AM UTC | Feb 20,2019 09:51 AM UTC | jQuery | 5 |
![]() |
Tags: ejGrid |
$("#Grid").ejGrid({
// the datasource "window.gridData" is referred from jsondata.min.js
dataSource: window.gridData,
allowPaging: true,
rowSelecting: function(args){
if(this.getContentTable().find(".gridform").length) //to check whether there is edit form or not
args.cancel = true;
},
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] },
columns: [
…………………………………………………………….
}); |
$("#Grid").ejGrid({
// the datasource "window.gridData" is referred from jsondata.min.js
dataSource: window.gridData,
allowPaging: true,
actionBegin: function(args){
if(args.requestType == "paging"){
if(this.getContentTable().find(".gridform").length){
args.cancel = true;// prevent the default paging action
alert("record is being edited"); // alert the user
var pag = this.getPager().ejPager("instance");
pag.setModel({currentPage: args.previousPage});
}
}
},
enableAutoSaveOnSelectionChange: false,
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },
toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] },
columns: [
……………………………………………………………………………..
]
}); |
$(function () {
$("#Grid").ejGrid({
// the datasource "window.gridData" is referred from jsondata.min.js
dataSource: window.gridData,
allowPaging: true,
allowSorting: true,
allowReordering: true,
showColumnChooser: true,
allowFiltering: true,
rowDragStart: function (args) {
if (this.getContentTable().find(".gridform").length)
args.cancel = true;
},
columnDragStart: function (args) {
if (this.getContentTable().find(".gridform").length)
args.cancel = true;
},
actionBegin: function (args) {
if (args.requestType != "cancel" && args.requestType != "save") {
if (!ej.isNullOrUndefined(this.getContentTable())) {
if (this.getContentTable().find(".gridform").length) {
args.cancel = true;
alert("record is being edited");
if (args.requestType == "paging") {
var pag = this.getPager().ejPager("instance");
pag.setModel({ currentPage: args.previousPage })
}
}
}
}
},
rowSelecting: function (args) {
if (this.getContentTable().find(".gridform").length) //to check whether there is edit form or not
args.cancel = true;
},
………………………………………………………………………..
columns: [
………………………………………………………………………….
]
});
}); |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.