Sure. I had variable number of rows with two fixed columns in the datatable. Here is what I did to remove the elements in the datatable:
Code:
while (tablebody.hasChildNodes()) { // while tbody has datarow elements
tablebody.firstChild.firstChild.nodeValue = null;
tablebody.firstChild.lastChild.nodeValue = null;
while (tablebody.firstChild.hasChildNodes()) {
tablebody.firstChild.removeChild(tablebody.firstChild.firstChild);
}
tablebody.removeChild(tablebody.firstChild);
}
datatable.removeChild(tablebody);
Hope it helps!