[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"
datapath="activeScenarioData:/Scenario/OverlayAlgorithm"
defaulttext="Select..." ondata="selectActiveOverlayModel();">
<textlistitem datapath="OverlayModelList:/model" text="$path{'text()'}" value="$path{'@value'}" />
<method name="selectActiveOverlayModel">
<![CDATA[
var selectedIdNode = new LzDataPointer(this,
{xpath:"activeScenarioData:/Scenario/OverlayAlgorithm/Id/text()"});
this.selectItem(selectedIdNode.data);
]]>
</method>
</combobox>
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/
archives/2005/05/about_that_serverless_app.html
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
soon').
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------- 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