These are chat archives for ThoughtWorksInc/Binding.scala

Apr 2018
杨博 (Yang Bo)
Apr 10 2018 02:39
@asoltysik Feel free to create new wiki pages for motive examples.
Aslo you can edit the ScalaDoc for basic concept and simple independent examples.
Ankit Soni
Apr 10 2018 12:52

hi guys, im trying a very simple example and i dont understand why it doesnt work -

  val squareValues:List[Var[Any]] = List(

  def square(id: Int): Binding[Node] = {
    def clickHandler() = { (_:MouseEvent) =>
      println(f"click $id");

    <button class="square" onclick={clickHandler}>{squareValues(id).value.toString}</button>
    tdom.render(appRoot, square(0))

now clicking the square doesnt change whats displayed.

nvm i got it working… i mixed up bind and value
Andrzej Sołtysik
Apr 10 2018 14:39
You shouldn't use value inside the dom method
replace this: {squareValues(id).value.toString} with this: {squareValues(id).bind.toString}
Andrzej Sołtysik
Apr 10 2018 14:44
@ankitson bind is the method that does actual binding to a var and registers your square method to change when the var changes
Ankit Soni
Apr 10 2018 17:32
@asoltysik yep, i got it working.. thanks!
im still having trouble getting this working if anyone can take a look - its asimple tic tac toe game, from the React tutorial. the status is a binding, but it does not update when squares change
but i did bind not value..