:: Forum >> Version 1 >>

Get XML data for make searh or sort and insert a row

I woul like to make a search on the grid like this: /javascript.forum.797.2/ but my data source is a XML.
Another question is how I can put a form under the grid to insert adiotional rows on the grid?
How can I do?
Thanks and happy gridding
JRC
Wednesday, May 5, 2004
You can iterate the Nodes of the XML document and do a regular expression match. I am not exactly sure how to do the regular expression part, but I imagine it going something like this


// grid is rendered and responseXML is received
var stringToFind = ...;
var 
columnXPath getXPathOfColumnToSearch();
var 
xmlDoc activeTableXML.getXML();
var 
nodes xmlDoc.selectNodescolumnXPath );
var 
matchingRows = new Array();
for(
i=0;i<nodes.length;i++) {
   var 
nodes[i].text
   
if (s.match(stringToFind)) {
      
matchingRows.push); 
   }
}
doSomethingInterestingWithMatchingRowsmatchingRows );
 
To add rows to the grid, you will have to manipulate the XML Document using the DOM API, and then refresh the grid.
gbegley
Thursday, May 6, 2004
Thanks, I'll try.
JRC
Thursday, May 6, 2004



This topic is archived.

Back to support forum

Forum search