Full Edit WebGrid Control Lrcgrid (4) - Scripting Library and Style Table
Script Base: Contains a function of the control client operation. include:
Switching the table row to the edit mode: chGEDitrow (RowIndex, Tab) () Switch the table column to the edit mode: chGEDIT (ColIndex, Tab) SQL statement for the client constructor Update the database: Buildsql (TabName) Add new Recorded function: addrow (Tab) Removes newly added lines of functions: 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 For (var j = 0; j )! = -1) {var Selv = OneRow.cells [k] .firstchild.Options [OneRow.cells [k] .firstchild.selectedindex] .value; updsql = Updsql "" SELV ""; Else {UPDSQL = UPDSQL "'" "'";} IF (k 1! = Cellen) {UPDSQL = ",";} else {UPDSQL = " ) / r ";}}}} var Tabbody = tabname.tbodies [0]; var len = tabbody.rows.LENGTH; tabbody.rows [len-1] .Cells [hidIndex] .childnodes [5] .value = Updsql Return True;} function addrow (tab) {var Tabbody = tab.tbodies [0]; var Anderow; var rowlen = Tab.Rows.Length; var cellen = tab.rows [0] .Cells.Length; var isadd = Tab.GetaTribute ("isadd"); var isdel = tab.getattribute ("isdel"); if (isdel == 'true') {Cellen = Cellen -1;} var newrow = tabbody.insertrow (Rowlen-1); NEWROW.ID = "lrcnewrow"; // for (var i = 0; i -1) {var innert = tabbody.rows [1] .cells [i] .innerhtml; newcel.innerhtml = innert; newcel.firstchild.disabled = false;} else { .lrc_txt_edit { Border-width: medium; Border-style: groove; Font-weight: bolder; Background-color: yellow; Width: 95; } .LRC_TXT_NORMAL { Border-style: groove; Border-width: thin; Font-weight: Normal; Background-color: # f5f7fb; Width: 95; } .lrc_txt_hi { Border-style: none; Width: 95; Background: URL (images / txt_back.gif); } .LRC_TXT_SHOW { Border-style: groove; Width: 95; Background-color: #fffff; }
var str = "; newcel.innerhtml = str;}} else {
var str = ""; newcel.innerhtml = str;}}} function removerow (tab) {var tabbody = tab.tbodies [0]; var OneRow; var rowlen = tab.rows.LENGTH ; If (tabbody.rows [rowlen-2] .id == "lrcnewrow") {tabbody.deleterow (rowlen-2);}} style table file: