WebGrid Edit Global Functions
wgGetFirstEditableCell |
Description Gets the first editable cell index of the specified row. Parameters row ( object - row element )
Return Value integer This sample shows how to get the first editable cell index in the specified row.
function doRowSelect(controlId, tblName, rowIndex, rowEl)
{ //gets the first editable cell var firstCellIndex = wgGetFirstEditableCell(rowEl); return true; } |
wgGetNextEditableRow |
Description Gets the next editable row from specified row. Parameters
Return Value
function doRowSelect(controlId, tblName, rowIndex, rowEl)
{ //gets the grid object var grid = ISGetObject(controlId); //gets the table element var tbl = grid.Tables[tblName].GetElement(WG40.BODY,WG40.HTMLTABLE); //gets the next editable row wgGetNextEditableRow(tbl,rowEl); return true; } |
wgGetPrevEditableRow |
Description Gets the previous editable row from specified row. Parameters
Return Value
function doRowSelect(controlId, tblName, rowIndex, rowEl)
{ //gets the grid object var grid = ISGetObject(controlId); //gets the table element //gets the previous editable row |
wgGetNextEditableCell |
Description Gets the next editable cell based on a given cell element or row element. Parameters
Return Value
function doEnterEditMode(gridId,tblName,editObject)
{ //get the grid object var grid = ISGetObject(gridId); //get the current row object var row = grid.GetSelectedObject().GetRowObject(); //get the current cell element var cell = row.GetCells().GetNamedItem("City").GetElement(WG40.BODY,WG40.HTMLCELL); //get the next editable cell var nextCell = wgGetNextEditableCell(cell); return true; } |
wgGetPrevEditableCell |
Description Gets the previous editable cell based on a given cell element or row element. Parameters
Return Value
function doEnterEditMode(gridId,tblName,editObject)
{ //get the grid object var grid = ISGetObject(gridId); //get the current row object var row = grid.GetSelectedObject().GetRowObject() //get the current cell element var cell = row.GetCells().GetNamedItem("City").GetElement(WG40.BODY,WG40.HTMLCELL); //get the previous editable cell var prevCell = wgGetPrevEditableCell(cell); return true; } |
wgGetLastEditableCell |
Description Gets the last editable cell of the specified row element. Parameters
Return Value
function doEnterEditMode(gridId,tblName,editObject)
{ //get the grid object var grid = ISGetObject(gridId); //get the current row object var rowEl = grid.GetSelectedObject().GetRowObject(). GetElement(WG40.BODY,WG40.HTMLROW); //get the last editable cell var lastCell = wgGetLastEditableCell(rowEl); return true; } |
wgActiveCellValid |
Description Determines whether the specified row element is currently an active cell row. Parameters
Return Value
function doEnterEditMode(gridId,tblName,editObject)
{ //get the grid object var grid = ISGetObject(gridId); //get the row element of the selected row var rowEl = grid.GetSelectedObject().GetRowObject().GetElement(); //determines whether or not the selected row is an active cell row var flag = wgActiveCellValid(grid,rowEl); //will return true if in edit mode return true; } |
wgIsRowEditable |
Description Determines whether or not the specified row is editable. Parameters
Return Value
function doRowSelect(gridId, tblName, rowIndex, rowEl)
{ var flag = wgIsRowEditable(rowEl); return true; } |
wgGetUnMask |
Description Unmask a value of a specified cell. Parameters
Return Value
function doEnterEditMode(gridId,tblName,editObject)
{ //get the grid object var grid = ISGetObject(gridId); //get the table object var oTbl = grid.RootTable; //get the cell element var cell = oTbl.GetRow(0).GetCells().GetNamedItem("ShipAddress").GetElement(); var col = grid.GetColumnByElement(cell); //unmask the cell's value wgGetUnMask(grid,col,cell,true,cell.innerText); return true; } |
wgGetMask |
Description Masks a value of a specified cell. Parameters
Return Value
function doEnterEditMode(gridId,tblName,editObject)
{ //get the grid object var grid = ISGetObject(gridId); //get the table object var oTbl = grid.RootTable; //get the table element var eTbl = oTbl.GetElement(WG40.BODY,WG40.HTMLTABLE); //get the cell element var cell = oTbl.GetRow(0).GetCells().GetNamedItem("ShipAddress").GetElement(); //mask the cell's value wgGetMask(grid,editObject,cell.innerText,eTbl,cell); return true; } |
wgDispObjGeneric |
Description Displays generic edit object according to grid's active cell and specified parameters. Parameters
Return Value
function doEnterEditMode(gridId, tblName, editObject)
{ //get the grid object var grid = ISGetObject(gridId); //get the table object var oTbl = grid.RootTable; //get the cell element var cell = oTbl.GetRow(0).GetCells().GetNamedItem("ShipAddress").GetElement(); //display the edit object at the specified cell wgDispObjGeneric(grid, editObject.element, cell, 1, 1, null, null, false); return true; } |
wgIsRowMarkedEdit |
Description Determines whether or not the specified row has been marked as edited. Parameters
Return Value
function doEditKeyDown(gridId, tblName, editObject)
{ //get the grid object var grid = ISGetObject(gridId); //get the row element of the first row var rowEl = grid.RootTable.GetRow(0).GetElement(WG40.BODY,WG40.HTMLROW); //if the row element is dirty if(wgIsRowMarkedEdit(rowEl)) alert("Row 1 is marked edit"); return true; } |
wgIsRowDirty |
Description Determines whether or not the specified row is dirty (one of its cells' content has been modified). Parameters
Return Value
function doEditKeyDown(gridId, tblName, editObject)
{ //get the grid object var grid = ISGetObject(gridId); //get the row element of the first row var rowEl = grid.RootTable.GetRow(0).GetElement(WG40.BODY,WG40.HTMLROW); //if the row element is dirty if(wgIsRowDirty(rowEl)) alert("Row 1 is dirty"); return true; } |
wgHighlightEditCell |
Description Highlights specified cell as current active edit cell. Parameters
Return Value
function doButtonClick()
{ //get the grid object var grid = ISGetObject("WebGrid1"); //get the table object var table = grid.RootTable; //get the first row object var row = table.GetRow(0); //get the first cell element var cell = row.GetCell(0).GetElement(); //highlight the cell wgHighlightEditCell(cell); return true; } |