Richard Searle

home

Surprising difference between Shtml ajaxButton and Shtml ajaxCheckbox

06 Aug 2011

Consider the following code
 def clear = SHtml.ajaxButton("Clear", ()=> {
     this ! Clear
     Noop
     }
  )

  def checkbox = SHtml.ajaxCheckbox(true, selected => {
    this ! SetScroll(selected)
  }, "id" -> check)
Note the Noop reference at the end of callback function for the ajaxButton to satisfy the signature: ()=>JsCmd However the signature for the ajaxCheckbox callback is (Boolean) =>JcCmd. However, in this case the compiler accepts Unit as the "return" value. This implies there is an implicit conversion from Unit to Noop, that is local to ajaxCheckbox!