Full edit WebGrid Control Lrcgrid (4)--script library and style sheet
Source: Internet
Author: User
Full edit WebGrid Control Lrcgrid (4)--script library and style sheet
Script Library: A function that contains a control client action. Including:
function to switch table rows to edit mode: Chgeditrow (Rowindex,tab) ()
function to switch table columns to edit mode: Chgedit (Colindex,tab)
To construct an SQL statement that updates a database on a client: BuildSQL (tabname)
Functions to add new records: addrow (tab)
Remove the newly added row function: removerow (tab)
All JS code:
function Chgeditrow (rowindex,tab)
{
var tabbody = tab.tbodies[0];
var IsE = 0;
alert (RowIndex);
alert (tabbody.rows[rowindex].cells.length);
for (var i = 0;i< tabbody.rows[rowindex].cells.length;i++)
{
alert (tabbody.rows[rowindex].cells[i].childnodes[0].id);
if (Tabbody.rows[rowindex].cells[i].haschildnodes ())
{
if (Tabbody.rows[rowindex].cells[i].childnodes[0].nodetype!= 3)
{
if (Tabbody.rows[rowindex].cells[i].childnodes[0].id.indexof (' lrctb_ ')!=-1)
{
if (!tabbody.rows[rowindex].cells[i].childnodes[0].disabled)
{
Tabbody.rows[rowindex].cells[i].childnodes[0].disabled = true;
Tabbody.rows[rowindex].cells[i].childnodes[0].classname = "Lrc_txt_hid";
}
Else
{
tabbody.rows[rowindex].cells[i].childnodes[0].disabled = false;
Tabbody.rows[rowindex].cells[i].childnodes[0].classname = "Lrc_txt_show";
}
}
else if (tabbody.rows[rowindex].cells[i].childnodes[0].id.indexof (' Lrcdrl_ ')!=-1)
{
if (!tabbody.rows[rowindex].cells[i].childnodes[0].disabled)
{
Tabbody.rows[rowindex].cells[i].childnodes[0].disabled = true;
}
Else
{
tabbody.rows[rowindex].cells[i].childnodes[0].disabled = false;
}
}
}
}
}
}
function Chgedit (colindex,tab)
{
var tabbody = tab.tbodies[0];
var Onerow;
if (tabbody.rows[1].cells[colindex].childnodes[0].disabled)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.