Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1280
Webdatagrid - Adding a new row at client side
posted

Hi,

We are moving on to Infragistics 13.1. Please find the code below which we used to achieve 'copy' of a row at client side.

Please review and need your urgent suggestions on the snippet. 

We are stuck up as igtbl_addNew doesnot seem to exist now.

Code snippet - Infragistics 7.3

function Copy(xmlRowData)
{
try
{
var theGrid = igtbl_getGridById(ManageItems.gridClientId);
var copiedRow = igtbl_addNew(ManageItems.gridClientId, 0);

var xmlDoc = jsAJAX.CreateXmlDocument();
xmlDoc.loadXML(xmlRowData);
var rowData = xmlDoc.firstChild.firstChild;

var rowCells = rowData.childNodes;
for (var i = 0; i < rowCells.length; i++)
{
var cell = copiedRow.getCellFromKey(rowCells[i].nodeName);

for (var j = 0; j < rowCells[i].attributes.length; j++)
{
switch (rowCells[i].attributes[j].nodeName)
{
case 'celltext':
cell.setValue(rowCells[i].attributes[j].value);
break;
case 'cellvalue':
var theCellElement = cell.getElement();
var theCheckbox = theCellElement.children[0].children[0];
if (rowCells[i].attributes[j].value == 'true')
theCheckbox.checked = true;
else
theCheckbox.checked = false;
break;
case 'disabled':
if (rowCells[i].nodeName.toLowerCase() == 'delete'
|| rowCells[i].nodeName.toLowerCase() == 'readonly')
{
var theCellElement = cell.getElement();
var theCheckbox = theCellElement.children[0].children[0];
if (rowCells[i].attributes[j].value == "true")
theCheckbox.disabled = true;
else
theCheckbox.disabled = false;
}
if (rowCells[i].attributes[j].value == 'true')
cell.setEditable(false);
else
cell.setEditable(true);
break;
case 'innerHTML':
var theCellElement = cell.getElement();
var theNOBR = theCellElement.children[0];
theNOBR.innerHTML = rowCells[i].attributes[j].value;
break;
case 'TargetURL':
var theCellElement = cell.getElement();
var theLink = theCellElement.children[0].children[0];
theLink.setAttribute('href', rowCells[i].attributes[j].value);
break;
case 'textAlign':
document.getElementById(cell.Id).style.textAlign = rowCells[i].attributes[j].value;
break;
}
}
}

}
catch (e)
{

}
}