Skip to content
Snippets Groups Projects
Commit 36deb99d authored by RomanSteinberg's avatar RomanSteinberg
Browse files

ADD: esc button handler on rating page

parent 05059849
Branches
Tags
No related merge requests found
var $ = jQuery;
$(function() {
var cancelFlag = false;
function AdjustTable() {
var jWrap = $('div.main_layer');
......@@ -182,12 +183,23 @@ $(function() {
function Rating(jThis, oldRate) {
oldRate = parseInt(oldRate);
// Здесь jThis - div rateCell, а не input, который является дочкой
if (cancelFlag) {
var str = ""
if (oldRate != -1)
str = oldRate;
jThis.children("input").val(str);
cancelFlag = false;
return;
}
jThis.children("input").attr("disabled", true);
var newRate = 0;
if (jThis.children("input").val() !== "")
newRate = parseInt(jThis.children("input").val());
if (newRate == oldRate)
return;
......@@ -386,7 +398,9 @@ $(function() {
var col = g_col;
var direction;
switch (e.keyCode) {
case 27: cancelFlag = true; // esc
case 13: // enter
case 40: // down arrow
direction = Direction.Down;
break;
case 38: // up arrow
......@@ -395,9 +409,6 @@ $(function() {
case 39: // right arrow
direction = Direction.Right;
break;
case 40: // down arrow
direction = Direction.Down;
break;
case 37: // left arrow
direction = Direction.Left;
break;
......@@ -430,6 +441,7 @@ $(function() {
// Нажатие на чекбокс "Неявка"
$(".absenceCheck").click(function(event) {
controlRowVisualization($(this).parent().parent());
});
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment