-
Notifications
You must be signed in to change notification settings - Fork 1
/
Index.cshtml
56 lines (54 loc) · 2.44 KB
/
Index.cshtml
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
56
<script type="text/javascript">
function Grid_BatchEditStartEditing(s, e) {
var templateColumn = s.GetColumnByField("C1");
if (!e.rowValues.hasOwnProperty(templateColumn.index))
return;
var cellInfo = e.rowValues[templateColumn.index];
C1spinEdit.SetValue(cellInfo.value);
if (e.focusedColumn === templateColumn)
C1spinEdit.Focus();
}
function Grid_BatchEditEndEditing(s, e) {
var templateColumn = s.GetColumnByField("C1");
if (!e.rowValues.hasOwnProperty(templateColumn.index))
return;
var cellInfo = e.rowValues[templateColumn.index];
cellInfo.value = C1spinEdit.GetValue();
cellInfo.text = C1spinEdit.GetText();
C1spinEdit.SetValue(null);
}
function Grid_BatchEditRowValidating(s, e) {
var templateColumn = s.GetColumnByField("C1");
var cellValidationInfo = e.validationInfo[templateColumn.index];
if (!cellValidationInfo) return;
var value = cellValidationInfo.value;
if (!ASPxClientUtils.IsExists(value) || ASPxClientUtils.Trim(value) === "") {
cellValidationInfo.isValid = false;
cellValidationInfo.errorText = "C1 is required";
}
}
var preventEndEditOnLostFocus = false;
function C1spinEdit_KeyDown(s, e) {
var keyCode = ASPxClientUtils.GetKeyCode(e.htmlEvent);
if (keyCode === ASPx.Key.Esc) {
var cellInfo = grid.batchEditApi.GetEditCellInfo();
window.setTimeout(function () {
grid.SetFocusedCell(cellInfo.rowVisibleIndex, cellInfo.column.index);
}, 0);
s.GetInputElement().blur();
return;
}
if (keyCode !== ASPx.Key.Tab && keyCode !== ASPx.Key.Enter) return;
var moveActionName = e.htmlEvent.shiftKey ? "MoveFocusBackward" : "MoveFocusForward";
if (grid.batchEditApi[moveActionName]()) {
ASPxClientUtils.PreventEventAndBubble(e.htmlEvent);
preventEndEditOnLostFocus = true;
}
}
function C1spinEdit_LostFocus(s, e) {
if (!preventEndEditOnLostFocus)
grid.batchEditApi.EndEdit();
preventEndEditOnLostFocus = false;
}
</script>
@Html.Action("GridViewPartial")