Lift CalendarMonthView 示例因 Lift 1.1-SNAPSHOT 失败

发布于 2024-08-14 02:29:37 字数 648 浏览 5 评论 0原文

新手 scala/lift 问题:

我查看了 CalendarMonthView 示例:

http://scala-tools.org/mvnsites/liftweb-1.0/lift-widgets/scaladocs/net/liftweb/widgets/calendars/CalendarMonthView.html

与 Lift 1.1 -M6 并编译并运行。

当我尝试将示例迁移到 Lift 1.1-SNAPSHOT 时,AnonFunc 的签名似乎已从类 JsRaw 更改为 JsCmd(这是一个特征)。

编译器在这里失败:

def itemClick = Full(AnonFunc("elem, param", JsCmd("alert('itemClick' + param + ' - ' + elem.nodeName)")))

未找到:值 JsCmd

我错过了什么吗?

问候 保罗

A newbie scala/lift question:

I checked out the CalendarMonthView sample:

http://scala-tools.org/mvnsites/liftweb-1.0/lift-widgets/scaladocs/net/liftweb/widgets/calendars/CalendarMonthView.html

with Lift 1.1-M6 and it compiled and worked.

When i tried to migrate the sample to Lift 1.1-SNAPSHOT the signature of AnonFunc seems to have changed from class JsRaw to JsCmd (which is a trait).

The compiler fails here:

def itemClick = Full(AnonFunc("elem, param", JsCmd("alert('itemClick' + param + ' - ' + elem.nodeName)")))

not found: value JsCmd

am i missing something ?

Regards
Paul

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

绅士风度i 2024-08-21 02:29:37

我在子项目

/lift-modules/lift-widgets

中发现了 CalendarMonthView 示例的新 Lift 1.1-SNAPSHOT 实现,其中还有其他令人印象深刻的小部件示例:-)

最好的方法是通过以下方式获取整个 liftweb 存储库:

git clone git://github.com/dpp/liftweb.git

I found the new Lift 1.1-SNAPSHOT implementation of the CalendarMonthView sample in the sub-project

/lift-modules/lift-widgets

which has other quite impressive widget samples :-)

The best way is to get the whole liftweb repo via:

git clone git://github.com/dpp/liftweb.git

望笑 2024-08-21 02:29:37

尝试使用 net.liftweb.http.js.JE.JsRaw 而不是 JsCmd:

def itemClick = Full(AnonFunc("elem, param", JsRaw("alert('itemClick' + param + '-' + elem.nodeName)")))

我不确定这是否会通过 AnonFunc 中的 elem 和 param,但我相信是这样

Try using net.liftweb.http.js.JE.JsRaw instead of JsCmd:

def itemClick = Full(AnonFunc("elem, param", JsRaw("alert('itemClick' + param + '-' + elem.nodeName)")))

I'm not sure if that will pass through your elem and param from the AnonFunc, but I believe so

酷炫老祖宗 2024-08-21 02:29:37

此问题有两种解决方案:

  1. 使用 JsCmds jsExp 到 JsCmd 转换器。
  2. 创建一个新的 JsCmd 对象。

为了说明这两个示例,假设您的原始命令是:

def dayClick = Full(AnonFunc("elem, param", JsRaw("alert('day was clicked')")))

转换器将是:

import net.liftweb.http.js.JsCmds.jsExpToJsCmd
def dayClick = Full(AnonFunc("elem, param", JsRaw("alert('day was clicked')"))) 

新命令将是:

import net.liftweb.http.js.JsCmd
def dayClick = Full(AnonFunc("elem, param",
                             new JsCmd("alert('day was clicked')"))) 

当然,这些不是完整的导入列表,只是相关更改所需的那些导入。

There are two solutions to this problem:

  1. Use the JsCmds jsExp to JsCmd converter.
  2. Create a new JsCmd object.

To illustrate these two examples, assuming that your original command was:

def dayClick = Full(AnonFunc("elem, param", JsRaw("alert('day was clicked')")))

The the converter would be:

import net.liftweb.http.js.JsCmds.jsExpToJsCmd
def dayClick = Full(AnonFunc("elem, param", JsRaw("alert('day was clicked')"))) 

And the new Command would be:

import net.liftweb.http.js.JsCmd
def dayClick = Full(AnonFunc("elem, param",
                             new JsCmd("alert('day was clicked')"))) 

Of course, those are not full import lists, simply those imports that are needed for the change in question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文