More Database Form Functions with HTML - The showLastRow() Function (Page 3 of 6 )
The main role of this function is to take you, the user, to the last row. This is the code:
function showLastRow()
{
//add to recordset any data that might have been included in the controls
if (addMode == true)
{
addRowToRecordset();
//after adding, you must go out of the addMode, so reset the addMode variable
addMode = false;
makeReadOnlyInputControls();
//enable the buttons that were disabed in the add process
enableButtons('E1','D1','F1','So1');
}
//edit any row of the recordset that might have been edited at the form
if (editMode == true)
{
editRowToRecordset();
//after adding, you must go out of the editMode, so reset the editMode variable
editMode = false;
makeReadOnlyInputControls();
//enable the buttons, Edit, Delete, Clear, Find, Sort.
enableButtons('E1','D1','C1','F1','So1');
}
//display the last row
index = numberOfRows - 1; //last index in array
for (j=0;j<6;j++)
{
//form the input text control ID
CID = "EI" + j;
//form the recordset ID
RID = "TD" + index + j;
document.getElementById(CID).value = document.getElementById(RID).innerHTML;
}
//show the data row number
document.getElementById('RowPosition').value = index + 1;
//disable the showNextRow and showLastRow Buttons
disableButtons('SN1','SL1');
//enable the showFirstRow and showPreviousRow Buttons if the recordset has more than one row
if (numberOfRows > 1)
enableButtons('SFA1','SP1');
}
Please enable JavaScript to view the comments powered by Disqus. blog comments powered by