69 lines
1.9 KiB
JavaScript
69 lines
1.9 KiB
JavaScript
var currow=0;
|
|
var lastrow=0;
|
|
function InitPage()
|
|
{
|
|
$('form tbody.scrollContent tr').hover(function () {
|
|
$('#row'+lastrow).removeClass('rowhover');
|
|
ResetRow();
|
|
$(this).addClass('rowhover');
|
|
}, function () {
|
|
$(this).removeClass('rowhover');
|
|
});
|
|
$('form tbody.scrollContent tr').click(function () {
|
|
GetRowData(this);
|
|
});
|
|
}
|
|
function ResetRow()
|
|
{
|
|
currow=0;
|
|
lastrow=$('#casetable tr').length-1;
|
|
}
|
|
function GetRowData(SelectedRow)
|
|
{
|
|
/*QueryStr="rand="+Math.round(Math.random()*4+1)+"&uuid="+$("#"+SelectedRow.id+"uuid").val()+"&pid="+$("#"+SelectedRow.id+"portid").val();
|
|
var retVal=0; // Legacy commented example retained without removed browser API.
|
|
if(retVal==1)
|
|
{
|
|
$("#"+SelectedRow.id+"col").html("<img src='/matrix/images/edited.png' title='Details has been edited successfully. Please click refresh button to see the changes' />");
|
|
}*/
|
|
$("#uuid").val($("#"+SelectedRow.id+"uuid").val());
|
|
SubmitForm("caseedit", "_blank", "caseGrid");
|
|
}
|
|
function keyListen(param1,param2,e) {
|
|
var keycode = e.keyCode;
|
|
if(keycode==13)
|
|
{
|
|
GetRowData(document.getElementById("row"+currow));
|
|
}
|
|
else
|
|
{
|
|
if(keycode==40)
|
|
{
|
|
currow=currow+1;
|
|
if(currow>=$('#casetable tr').length){currow=1;lastrow=$('#casetable tr').length-1;}
|
|
}
|
|
if(keycode==38)
|
|
{
|
|
currow=currow-1;
|
|
if(currow<=0){currow=$('#casetable tr').length-1;lastrow=1;}
|
|
}
|
|
$('#row'+currow).addClass('rowhover');
|
|
$('#row'+lastrow).removeClass('rowhover');
|
|
document.getElementById('row'+currow).focus();
|
|
lastrow=currow;
|
|
}
|
|
}
|
|
|
|
function callkeydownhandler(evnt) {
|
|
var ev = evnt;
|
|
var focusedRow = ev.target && ev.target.tagName === "TR" ? ev.target : null;
|
|
if ((ev.key === "Enter" || ev.keyCode === 13) && focusedRow) {
|
|
ev.preventDefault();
|
|
GetRowData(focusedRow);
|
|
return;
|
|
}
|
|
keyListen('','',ev);
|
|
}
|
|
|
|
window.document.addEventListener("keydown", callkeydownhandler, false);
|