Hi all, I need some basic table functionality and though about adding in one of the many JS libraries but decided to try and work it out in Elm since I only need some very basic functionality.
I have this working but need some direction on how to pass information about the TD being edited. I thought about setting data attributes on the TD which would work but am unable to decipher how to get the target of the event and then those details. Further, once I have the data ... how to I send that back through to the model? Thanks, Thomas http://elm-lang.org/try import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (on) import Json.Decode as JD exposing (Decoder) main = beginnerProgram { model = "", view = view, update = update } targetInnerHtml : Decoder String targetInnerHtml = JD.at ["target", "innerHTML"] JD.string view model = div [] [ table [] [ tr [] [ td [] [text "Enter Something below"] ] , tr [] [ td [ attribute "data-x" "1" , attribute "data-y" "1" , on "input" (JD.map Input targetInnerHtml) , contenteditable True , style [("border","solid black 1px")] ][] ] ] , div [] [text ("You entered:" ++ model)] ] type Msg = Input String update msg model = case (Debug.log "msg:" msg) of Input str -> str -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
