On Tuesday, October 11, 2016 at 11:21:05 AM UTC+1, Rupert Smith wrote:
> I'm interested in expanding on the counter example to add more complexity 
> - and I have a component in mind that will be useful to me - the listbox 
> that I was working with previously.

So I have a first pass at making a listbox component, you can find it here:


Sticking with the Polymer elements naming convention, I called this library 
'wood', since that also fits with the Elm theme...
I create a listbox like this:

root : Model -> Html Msg
root model =
        [ items (Dict.fromList [ ( "1", "one" ), ( "2", "two" ), ( "3", 
"three" ) ])
        , onSelectedChanged SelectChanged

Which is ok, but what I really want is for the listbox user to be able to 
display more than just a string in the listbox, along these lines:

root : Model -> Html Msg
root model =
    listbox [ attrForSelect "value", onSelectedChanged SelectChanged ]
        [ listItem  [ value "1" ] [ text "one" ],
          listItem  [ value "2" ] [ text "two" ],

But if the listitems are rendered withon the scope of the consuming Elm 
program, I run straight away into the previously discussed issue of not 
knowing which component to attach events to.

A listbox seems like quite a good component for allowing the consumer to 
decide how to render the list items. I might like an icon for example, or a 
checkbox which gets ticked when an item is selected, and so on. But it is 
wokring nicely for a plain text list.

You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to