Richard Searle's Blog

Thoughts about software

Archive for August, 2011

Surprising difference between Shtml ajaxButton and Shtml ajaxCheckbox

Posted by eggsearle on August 6, 2011

Consider the following code

 def clear = SHtml.ajaxButton("Clear", ()=> {
     this ! Clear

  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!


Posted in lift, Scala | Leave a Comment »