Guofeng Zhang
unread,Nov 17, 2010, 10:12:05 PM11/17/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to The Lift Book
I reading Exploring Lift, and have some questions confused me. I am
new to Lift, this confuse me for days, thanks for your help.
(1) In the section "XML and JavaScript", you have a sample code:
val div = Jx(<div>Hi there</div>)
This will generate the following function:
function(it) {
var df = document.createDocumentFragment();
var vINIJ1YTZG5 = document.createElement('div');
df.appendChild(vINIJ1YTZG5);
vINIJ1YTZG5.appendChild(document.createTextNode('Hi there'));
return df;
}
How to write a code in Scala so that the client (browser) could invoke
the function?
(2) there is the following code segment:
var list = {
persons: [
{name: "Thor", race: "Asgard"},
{name: "Todd", race: "Wraith"},
{name: "Rodney", race: "Human"}
]
}
I think this should be the JavaScript code in the HTML file, am I
right?
Following the above, there is the following code segment:
def renderPerson =
Jx(<li class="item_header"> {JsVar("it", "name")}
is {JsVar("it", "race")}</li>)
Jx(<ul>{JxMap(JsVar("it.persons"), renderPerson)}</ul>)
I cannot understand how the value of the list variable is passed, that
is, why it.persons will reference to values of list variable?