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

Derek Adams derek_a_adams at yahoo.com
Fri Jun 10 12:29:47 PDT 2005


It seems like there should be a "defaultvalue" attribute on basecombobox.lzx that corresponds to a value in one of the list items. After the list items are created from the underlying data, the value component with the default value would be automatically selected. 
 
I have noticed some of the same timing issues that P T Withington mentioned when trying other methods of setting the default. There doesn't seem to be a way to handle defaulting the value in a databound combo via XML tags. You have to catch an event after everything is initialized and set it manually. I am guessing the "undefined" bug is probably a data init timing issue too.

Henry Minsky <henry.minsky at gmail.com> wrote:
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 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. 
> 
> > datapath="activeScenarioData:/Scenario/OverlayAlgorithm"
> defaulttext="Select..."
> ondata="selectActiveOverlayModel();">
> 
> > text="$path{'text()'}" value="$path{'@value'}" />
> 
> 
> > var selectedIdNode = new LzDataPointer(this, 
> 
> {xpath:"activeScenarioData:/Scenario/OverlayAlgorithm/Id/text()"});
> this.selectItem(selectedIdNode.data);
> ]]>
> 
> 
> 
> 
> 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 
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

		
---------------------------------
Do you Yahoo!?
 Yahoo! Mail - Find what you need with new enhanced search. Learn more.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openlaszlo.org/pipermail/laszlo-dev/attachments/20050610/1270465f/attachment.html


More information about the Laszlo-dev mailing list