【问题标题】:Grails Plugin Uploadr does not get rendered after Ajax callGrails Plugin Uploadr 在 Ajax 调用后未呈现
【发布时间】:2013-12-30 20:23:17
【问题描述】:

我遇到了以下问题,我在我的应用程序中使用 Grails。我喜欢编辑一个名为“任务”的条目,因此会弹出 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

【问题讨论】:

    标签: ajax grails


    【解决方案1】:

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

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

    已经完成了,简化了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-19
      • 2014-07-24
      • 2014-06-16
      • 1970-01-01
      • 2011-11-13
      • 1970-01-01
      相关资源
      最近更新 更多