3.2.0

Add New Row at Top

Hi All,

I am trying to add new row in grid dynamically. I have followed standard way as found in forum ie adding new row data.
<script>
var table = new Active.XML.Table;
   table.setURL("companies-simple.xml");
   table.request();   
 var obj = new Active.Controls.Grid;
 obj.setModel("data", table);
    document.write(obj);
<script> 
function AddRow()
{ 
   var dataXmlDoc = obj.getDataProperty('XML');
    var rootNode = dataXmlDoc.documentElement;
    var newRow = dataXmlDoc.createElement( "company" ); 
   [b] rootNode.insertBefore( newRow, rootNode.firstChild); 
    //rootNode.appendChild(newRow);[/b]
    obj.setRowProperty("count", rootNode.childNodes.length);  
    obj.refresh();  
}


I have tried both appendChild and insertBefore as put in bold letters above.
But new row is always added to BOTTOM instead desired at TOP.

I have also tried what was suggested by Alex in http://www.activewidgets.com/javascript.forum.945.3/changing-rows-urgent.html

Doing so give me error in refresh function of grid.

Does anyone solution for this.


Rajeev
June 9,

This topic is archived.

See also:


Back to support forum