Hi got2code,
We currently don't have a hook for developers to be notifiedimmediately after the data is loaded, and before it is flattenedinto a data set using the XPath. I've been meaning to add one, soI'll make sure we have one for the 1.5 release.
Until then, you can add your own hook by adding a notficationthe Spry.Data.XMLDataSet.prototype.onRequestResponse() method. In1.4 it looks like this:
Spry.Data.XMLDataSet.prototype.onRequestResponse =function(cachedRequest, req)
{
this.setDataFromDoc(cachedRequest.doc);
};
But you can add your own hook like this:
Spry.Data.XMLDataSet.prototype.onRequestResponse =function(cachedRequest, req)
{
var notificationData = { xmlStr: req.xhRequest.responseText,xmlDoc: cachedRequest.doc };
this.notifyObservers(''onDataLoaded'', notificationData);
this.setDataFromDoc(notificationData.xmlDoc);
};
and then you can add an observer to your data set like this:
ds1.addObserver(myObserverFunc);
...
function myObserverFunc(notificationType, notifier, data)
{
if (notificaitonType != ''onDataLoaded'')
return;
// You can now access the xml string or DOM document via:
//
// data.xmlStr or data.xmlDoc.
//
// Then adjust the XPath as necessary, or report your error.
}
--== Kin ==--
No comments:
Post a Comment