-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUpdateLogic.js
55 lines (55 loc) · 1.49 KB
/
UpdateLogic.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var visibleIndicies = [];
var errorMessage = "";
var buttonFlag = false;
function OnClick(s, e) {
if (visibleIndicies.length == 0)
grid.UpdateEdit();
else {
buttonFlag = true;
grid.PerformCallback(visibleIndicies);
}
}
function OnCancel(s, e) {
for (var i = 0; i < visibleIndicies.length; i++) {
var currentKey = grid.GetRowKey(visibleIndicies[i]);
var childgrid = ASPxClientControl.GetControlCollection().GetByName("detailGrid" + currentKey);
if (childgrid != undefined && childgrid != null) {
childgrid.CancelEdit();
}
}
grid.CancelEdit();
}
function OnConfirm(s, e) {
if (e.requestTriggerID == 'Grid' && buttonFlag) {
e.cancel = true;
}
}
function AddCurrentDetailGrid(visibleIndex) {
if (visibleIndicies.indexOf(visibleIndex) == -1)
visibleIndicies.push(visibleIndex);
}
function RemoveCurrentDetailGrid(visibleIndex) {
var arrayIndex = visibleIndicies.indexOf(visibleIndex);
if (arrayIndex > -1)
visibleIndicies.splice(arrayIndex, 1);
}
function OnExpanding(s, e) {
AddCurrentDetailGrid(e.visibleIndex);
}
function OnCollapsing(s, e) {
RemoveCurrentDetailGrid(e.visibleIndex);
}
function OnEndCallback(s, e) {
if (buttonFlag)
buttonFlag = false;
if (errorMessage != "") {
lbl.SetText(errorMessage);
errorMessage = "";
}
else
lbl.SetText("");
}
function OnCallbackError(s, e) {
errorMessage = e.message;
e.handled = true;
}