在Ajax调用之后,Grails Plugin Uploadr不会呈现

时间:2013-12-17 12:38:35

标签: ajax grails

我遇到了以下问题,我在我的应用程序中使用Grails。我喜欢编辑一个名为“task”的条目,因此一个Foundation 5 Reveal弹出并显示我的表单。这个Reveal是一个模板,在点击任务的编辑按钮后呈现,我用Ajax调用我的控制器并将新数据放入我的Reveal div中。

问题是,新数据包含我的Uploadr插件标签并且它没有渲染,这是有道理的,但我该如何解决?

<uploadr:add name="myFirstUploadr" path="res/img/aufgaben" 
allowedExtensions="gif,png,jpg,jpeg"/>

我正在关注Stacktrace:

Error 2013-12-17 13:29:02,573 [http-bio-8090-exec-9] ERROR [/LMS].[default]  - Servlet.service() for servlet [default] in context with path [/LMS] threw exception
Message: It looks like you are missing some calls to the r:layoutResources tag. After rendering your page the following have not been rendered: [defer]
    Line | Method
->> 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    724 | run . . . in java.lang.Thread

1 个答案:

答案 0 :(得分:2)

解决方案很简单,将Uploadr插件的require标签添加到部分View,而不是主布局,因此即使在Ajax-Call上也可以解析javascript和依赖项。

<r:require modules="uploadr"/>

<uploadr:add name="editTaskUploadr" path="${imagePath}" 
                 allowedExtensions="gif,png,jpg,jpeg">

<r:layoutResources/>
<r:layoutResources/>

已经完成了,简化了。