These are chat archives for ThoughtWorksInc/Binding.scala

2nd
Nov 2018
Wojtek Pituła
@Krever
Nov 02 2018 10:00
There is no explicit map or flatMap for Bindings, but one can use scalaz for that, right?
Wojtek Pituła
@Krever
Nov 02 2018 11:52

thanks. Another thing,: how this should be expressed correctly:

class ProcessDefsSelect(allDefs: BindingSeq[ProcessDefinition], selected: Var[Option[ProcessDefinition]]) {

  @dom
  def render: Binding[html.Select] = {
    <select class="ui dropdown" onchange={e: Event => selected.value = allDefs.bind.find(_.id == e.target.asInstanceOf[html.Select].value)} >
      {for (pDef <- allDefs) yield {
      <option value={pDef.id} selected={selected.bind.exists(_.id == pDef.id)} >
        {pDef.name}
      </option>
    }}
    </select>
  }

}

simple select component. This impl doesnt work due to allDefs.bind invoked in callback function...

Wojtek Pituła
@Krever
Nov 02 2018 12:12
assigning allDefs.bind to variable outside callback function works fine
Mustafa Kuscu
@mcku
Nov 02 2018 13:06
I have a question https://stackoverflow.com/questions/53119126/binding-scala-component-to-string-conversion. In this Gitter channel, there was a discussion on how to convert a scalatags typed tag to string. I need a similar way to do that for a Binding[Element].