gordyt
01-28-2005, 10:44 AM
Greetings All!
I am using datapointers to process the result of executing the doRequest() method of a dynamically-created LzDataset.
I have found that if I try and use a dynamically-created datapointer as follows then it does not work:
var xp = "myDataset:/*";
this.updateDatapointer = new LzDatapointer(
this, {xpath: xp, ondata: this.processResult}
);
the processResult method in the enclosing class instance never gets called.
However, if I declare a class like this:
<class name="MyDatapointer" extends="datapointer">
<attribute name="my_instance" />
<method event="ondata" args="d">
<![CDATA[
// do whatever you want here. can invoke some method defined
// in this.my_instance
]]>
</method>
</class>
And then do this down in the code:
var xp = "myDataset:/*";
this.updateDatapointer = new MyDatapointer(
this, {xpath: xp, my_instance: this}
);
Then in that case the ondata method in MyDatapointer does get called just fine. Am I doing something obviously wrong with my first attempt?
Thank you,
--gordon
I am using datapointers to process the result of executing the doRequest() method of a dynamically-created LzDataset.
I have found that if I try and use a dynamically-created datapointer as follows then it does not work:
var xp = "myDataset:/*";
this.updateDatapointer = new LzDatapointer(
this, {xpath: xp, ondata: this.processResult}
);
the processResult method in the enclosing class instance never gets called.
However, if I declare a class like this:
<class name="MyDatapointer" extends="datapointer">
<attribute name="my_instance" />
<method event="ondata" args="d">
<![CDATA[
// do whatever you want here. can invoke some method defined
// in this.my_instance
]]>
</method>
</class>
And then do this down in the code:
var xp = "myDataset:/*";
this.updateDatapointer = new MyDatapointer(
this, {xpath: xp, my_instance: this}
);
Then in that case the ondata method in MyDatapointer does get called just fine. Am I doing something obviously wrong with my first attempt?
Thank you,
--gordon