On Wed, Apr 29, 2009 at 12:16 AM, marius d. <[email protected]> wrote:

>
> Ok,
>
> Here is what I'm thinking of:
>
>  def ajaxButton(text: NodeSeq, jsFunc: Call, func: () => JsCmd,
> attrs: (String, String)*): Elem = {
>
>    val params = (name: String) => jsFunc.params ++ List(AnonFunc
> (makeAjaxCall(Str(name+"=true"))))
>
>    attrs.foldLeft(fmapFunc(func)(name =>
>        <button onclick={(Call(jsFunc.function, params
> (name):_*)).toJsCmd + "; return false;"}>{text}</button>))(_ % _)
>  }
>
>
> jsFunc impersonates a JavaScript function call. We are appending to
> the parameters list specified by the user the actual function that
> does the Ajax call.
>
> For exemplification here is a snippet function:
>
>  def button(xml: NodeSeq): NodeSeq = {
>      bind("f", xml,
>           "show" -> ajaxButton(Text("Press me"), Call("dialog", Str
> ("a param")), () => {println("pressed"); Noop})
>      )
>  }
>
> ... and here is the JavaScript function declaration:
>
>                <script type="text/javascript">
>                        function dialog(name, theCall) {
>                                alert("Got " + name);
>                                theCall();
>                        }
>                </script>
>
> .. it could be any JS function from a .js file etc.
>
> In this example the actaul Ajax call is made after clicking OK button
> of the alert dialog.


Sounds good.  Please add it.


>
>
> Br's,
> Marius
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to