The problem is probably caused with a bug at
net.liftweb.http.WiringUI. addJsFunc[T](cell: Cell[T], f: (T, Boolean)
=> JsCmd) method. I have made some workaround by preparing my version
of addJsFunc (see wiring.lib.MyWiringUI), instead of:
if (first || (ct > lastTime && value != lastValue)) {
lastValue = value
lastTime = ct
f(value, first)
} else Noop
})
I've put:
if (first || (ct > lastTime && value != lastValue)) {
lastValue = value
lastTime = ct
Noop
} else{
f(value, first)
}
In addition the result of MyWiringUI.toNode method is wrrappded with
renderTags method to be sure, that the first generated content is
actual. Now it looks like this:
def tags2(xhtml: NodeSeq): NodeSeq = {
val ne = MyWiringUI.toNode(xhtml, tagList, JqWiringSupport.fade)
((tags, ns) => renderTags(tags, ns))
renderTags(tagList.currentValue._1, ne)
}
I think that above example will be a usefull suggestion where to
search a real soultion for someone more experineced than me (I'm still
fresh in lift). I can see that it is not just a my problem:
http://stackoverflow.com/questions/5572857/ajaxbutton-not-working-when-using-lift-wiring
I've updated the example
https://github.com/mmigacz/lift_wiring with
described code.
btw. Today it's my birthday so it would be realy nice if I would get
an answer :)
Regards,
Maciek
> I have added to the examplehttps://
github.com/mmigacz/lift_wiringan
> index2.html page with two duplicated list of links. Both lists are
> generated with the same method. The first one loaded with wiring is
> inactive, while the second loaded directly is active.
> Below a part of example snippet, tags2 generates both list
>
> val tagFilter = ValueCell[Box[String]](Full(""))
> val tagList = tagFilter.lift(_.map( p
> =>tags.filter( _.startsWith(p) )).getOrElse(Nil))
> val selectedTags = ValueCell[List[String]](Nil)
>
> def tags2(xhtml: NodeSeq): NodeSeq = {
> WiringUI.toNode(xhtml, tagList, JqWiringSupport.fade)((tags, ns)
> => renderTags(tags, ns)) ++
> renderTags(tagList.currentValue._1, xhtml)
> }
>
> def renderTags( tags: List[String], ns: NodeSeq ): NodeSeq = {
> ("li" #> tags.map( row =>
> ".tag" #> SHtml.a(() => addTag(row), Text(row))
> ))(ns)
> }
>
> To run examplehttps://
github.com/mmigacz/lift_wiring just run: mvn