:: Forum >>

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

I woul like to make a search on the grid like this: http://www.activewidgets.com/messages/797-2.htm 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.selectNodes( columnXPath );
var matchingRows = new Array();
for(i=0;i<nodes.length;i++) {
var s = nodes[i].text
if (s.match(stringToFind)) {
matchingRows.push( i );
}
}
doSomethingInterestingWithMatchingRows( matchingRows );


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