For those who didn't notice it, there is an asterisk after the slash in 
this line:

>      <datapointer name = "dp" xpath="local:list:/*">

It's a subtle point.  (To put it mildly)

jrs





On May 2, 2006, at 11:22 AM, Adam Wolff wrote:

> Sorry I didn't see your question earilier. Before, you wrote:
>>    <datapointer name = "dp" xpath="local:list:/">
>
> This binds the datapointer to the dataset itself. It will not run 
> ondata
> or receive updates when the dataset loads data because the result of 
> its
> xpath expression doesn't change. I think that instead you want to 
> write:
>      <datapointer name = "dp" xpath="local:list:/*">
>
> This will run ondata only when the local:list dataset loads data.
>
>
> A
>
> On May 2, [EMAIL PROTECTED] wrote:
>
>>
>> Just to let you know that I finally got my datapipe class working as 
>> expected
>> - thanks a lot for everyone's help. The trick was to reassign the
>> datapointer's xpath attribute at the end of the ondata method. (4th 
>> line from
>> the end). This forces it to update the second time data is received, 
>> and not
>> just the first time.
>>
>> <class name = "datapipe" extends = "node">
>>    <attribute name = "table" type = "string" />
>>    <dataset name="list" type="http" request = "false" />
>>    <dataset name="action" type="http" request = "false" />
>>
>>    <method reference = "action" event="ondata">
>>        dp.setXPath("local:action:/");
>>    </method>
>>
>>    <datapointer name = "dp">
>>    <method event="ondata">
>>    if (this.xpathQuery("result/text()") == "success") {
>>        parent.list.doRequest();
>>        Debug.write("Operation succeeded");
>>    } else {
>>        Debug.write("Operation failed");
>>    }
>>     this.setXPath("local:list:/");
>>     </method>
>> </datapointer>
>> </class>
>>
>> The result is a canvas where all dynamic data automatically updates 
>> to stay in
>> sync with the table records whenever the database is updated.
>>
>> Thanks again for your help.
>>
>>
>> On 1 May 2006, at 18:27, Henry Minsky wrote:
>>
>>> I believe an empty local datset will be created by the <dataset>
>>> declaration. That is, it will have no child elements. There may be 
>>> some
>>> issue with how you are generating the ondata events. When I did this
>>> manually from the debugger, the xpath query worked fine.
>>>
>>>  <class name = "datapipe" extends = "node">
>>>      <attribute name = "table" type = "string" />
>>>      <dataset name="action" type="http" request = "false" />
>>>      <datapointer name='bar' xpath="local:action:/">
>>>        <method event="ondata">
>>>          var q = "results/text()";
>>>          Debug.write(q, this.xpathQuery(q));
>>>        </method>
>>>      </datapointer>
>>>   </class>
>>>
>>> <datapipe id='foo'/>
>>>
>>>
>>> In the debugger, I did this manually
>>>
>>> lzx> k = new LzDataElement("results")
>>> «LzDataElement#3| <results/>»
>>> lzx> c = new LzDataText("success!")
>>> «LzDataText(0)#4| []»
>>> lzx> k.appendChild(c)
>>> «LzDataText(0)#4| []»
>>> lzx> foo.action.appendChild(k)
>>> «LzDataElement#3| <results>success!</results>»
>>> lzx> foo.bar
>>> «LzDatapointer#0| <action><results>success!</results></action>»
>>> lzx> foo.bar.ondata.sendEvent()
>>> results/text() success!
>>> lzx>
>>>
>>>
>>> You're right there - the 'action' dataset is intended as a
>>> 'placeholder' that I can
>>> route requests through from the main canvas. The idea is that
>>> requests are
>>> fed through the action dataset and an updated set of records is
>>> returned via
>>> the 'list' dataset on successful submission. This in turn
>>> automatically updates
>>> any views bound to the list dataset.
>>>
>>> So there's no actual location for the action dataset until a request
>>> is made from
>>> the canvas - this was my intention, but I appreciate it's not the
>>> traditional method.
>>>
>>> Any other thoughts would be warmly received.
>>> http://rafb.net/paste/results/eh2soq66.html
>>>
>>>
>>>
>>>>> I'm having trouble referencing a dataset from within a class.
>>>>>
>>>>> The code here: http://rafb.net/paste/results/eh2soq66.html produces
>>>>> the error "couldn't find dataset for action:/" (Line 13 is where 
>>>>> it's
>>>>> referenced.)
>>>>>
>>>>> Would anyone be kind enough to suggest what I should do to correct
>>>>> it?
>>>
> _______________________________________________
> Laszlo-user mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user


_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to