[Laszlo-dev] Default selection in a combo populated from a dataset

Derek Adams derek_a_adams at yahoo.com
Fri Jun 10 11:42:04 PDT 2005

I ended up with a solution driven by the "ondata" event. It is somewhat of a hack since it directly calls the "selectItem(value)" method in basecombobox.lzx, but it seems to work.
<combobox editable="false" shownitems="6"
 defaulttext="Select..." ondata="selectActiveOverlayModel();">
 <textlistitem datapath="OverlayModelList:/model" text="$path{'text()'}" value="$path{'@value'}" />
 <method name="selectActiveOverlayModel">
   var selectedIdNode = new LzDataPointer(this, 

This example uses a value key that is outside of the dataset used to populate the dropdown. When the data for the value key changes, the ondata event updates the selected item in the list.
Thanks for the response!
Derek Adams

P T Withington <ptw at pobox.com> wrote:
Yes. I ran into the same problem: http://pt.withy.org/ptalk/ 

There are 2 issues: 1) all $path values are strings, so you need to 
test for `== 'true'`, and 2) you can't select an item until it is 
inited (so setting selected directly from the datapath happens 'too 

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openlaszlo.org/pipermail/laszlo-dev/attachments/20050610/9685201e/attachment.html

More information about the Laszlo-dev mailing list