PDA

View Full Version : How to use this XML data my combobox ?


Tipiweb
09-20-2007, 02:00 PM
Hello all !

I have a problem to make my combobox. I don't know how to put this xml data une my combobox because the example of the reference manual don't works.

I build an opensource groupware with openlaszlo ( http://kontoro.org )
My data is return by a webservice written in php.

the data return by php is :

<calendarDS>
<item>
<id>1</id>
<name>Maxime</name>
</item>
<item>
<id>2</id>
<name>Bruno</name>
</item>
</calendarDS>


lzx code of the combobox :

<combobox name="DiaryList" datapath="calendarDS:/item"
text="$path{'name/text()'}" value="$path{'id/text()'}" width="100%"/>


Can you help me please ?

Thanks,
Max

trucker_
09-20-2007, 02:13 PM
The datpath is wrong, the general syntax is: datapath="<datasetName>:/rootNode/nodes...", so i think you should have some like:<combobox name="DiaryList" datapath="myDataset:/calendarDS/item"
text="$path{'name/text()'}" value="$path{'id/text()'}" width="100%"/>

(replace myDataset w the correct name)

eyegony
09-20-2007, 02:46 PM
Try this:


<canvas>
<dataset name="ds">
<calendarDS>
<item>
<id>1</id>
<name>Maxime</name>
</item>
<item>
<id>2</id>
<name>Bruno</name>
</item>
</calendarDS>
</dataset>

<combobox name="DiaryList">
<textlistitem datapath="ds:/calendarDS/item"
text="$path{'name/text()'}"
value="$path{'id/text()'}"/>

<handler name="onvalue" args="value">
if ( this._initcomplete )
Debug.write( this, value );
</handler>
</combobox>
</canvas>

Tipiweb
09-20-2007, 09:22 PM
Thanks a lot eyegony and trucker ! ;)

It works :D

I use your two answer to make a great work.

My new code :

<combobox name="DiaryList" datapath="calendarDS:/" width="100%"/>>
<textlistitem datapath="item/"
text="$path{'name/text()'}"
value="$path{'id/text()'}"/>

<handler name="onvalue" args="value">
if ( this._initcomplete )
Debug.write( this, value );
</handler>
</combobox>


Thanks,
Max