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

Henry Minsky henry.minsky at gmail.com
Fri Jun 10 11:53:24 PDT 2005


I filed a bug on "undefined" appearing in combobox as a default value.
I wonder if this
is related.

http://www.openlaszlo.org/jira/browse/LPP-85


On 6/10/05, Derek Adams <derek_a_adams at yahoo.com> wrote:
> 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 dropdow! n. 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 
> _______________________________________________
> Laszlo-dev mailing list
> Laszlo-dev at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
> 
> 
> 


-- 
Henry Minsky
Software Architect
hminsky at laszlosystems.com



More information about the Laszlo-dev mailing list