venomdesign
Programmer
I have xml data populating a product type table, when a user click a 2 states are shown, depending on which state the user clicks a event is fired and if there are a lot of records for that state a pop-up window pops up saying loading.... I can get the pop-up to come up, but when the data is finished loading I need the window to close. Here is a chunk of code that I have written, any help would be great.
function doclick(service, state) {
var hasChildren = false;
var srcElem = window.event.srcElement;
var recNum = getParentWithTag(srcElem, "TABLE"
.recordNumber;
var entityId = ptypes.XMLDocument.selectSingleNode("//" + parentNodeName + "[" + (recNum-1) + "]/@" + parentNodeIdName).text;
var root = ptypes.XMLDocument.selectSingleNode("//" + parentNodeName + "[@" + parentNodeIdName + "='" + entityId + "']/" + state);
for (var i = 0; i<root.childNodes.length; i++) {
if (root.childNodes.nodeName == childNodeName) {
hasChildren = true;
break;
}
}
if (!hasChildren) {
//newDoc will be used to hold new data
var newDoc = newData.XMLDocument;
newDoc.async = false;
service = " + service + "&entityId=" + entityId + "&status=" + state;
newDoc.load(service);
//alert(newDoc.xml);
var newNode = newDoc.documentElement;
var newNodeList = newNode.selectNodes("//" + childNodeName);
var newNodeLength = newNodeList.length;
for(var i=0; i<newNodeLength; i++) {
root.appendChild(newNodeList.nextNode);
}
}
//alert(ptypes.xml);
//alert(service);
expandIt();
}
function doclick(service, state) {
var hasChildren = false;
var srcElem = window.event.srcElement;
var recNum = getParentWithTag(srcElem, "TABLE"
var entityId = ptypes.XMLDocument.selectSingleNode("//" + parentNodeName + "[" + (recNum-1) + "]/@" + parentNodeIdName).text;
var root = ptypes.XMLDocument.selectSingleNode("//" + parentNodeName + "[@" + parentNodeIdName + "='" + entityId + "']/" + state);
for (var i = 0; i<root.childNodes.length; i++) {
if (root.childNodes.nodeName == childNodeName) {
hasChildren = true;
break;
}
}
if (!hasChildren) {
//newDoc will be used to hold new data
var newDoc = newData.XMLDocument;
newDoc.async = false;
service = " + service + "&entityId=" + entityId + "&status=" + state;
newDoc.load(service);
//alert(newDoc.xml);
var newNode = newDoc.documentElement;
var newNodeList = newNode.selectNodes("//" + childNodeName);
var newNodeLength = newNodeList.length;
for(var i=0; i<newNodeLength; i++) {
root.appendChild(newNodeList.nextNode);
}
}
//alert(ptypes.xml);
//alert(service);
expandIt();
}