[opencms-dev] ${cms.enableReload} causes content to disappear

Tobias Karrer kartobi at gmail.com
Wed May 3 17:36:59 CEST 2017


Hi Clement,

seems there are two DOM elements inside your formatter.
Wrapping everything with another <div> should help:
<cms:formatter var="content" val="chart">
<div>
     ...
</div>
</cms:formatter>

Best,
Tobias

Am 02.05.2017 um 16:39 schrieb Clement Wee:
> Hi guys,
>
> I am using OpenCMS 10.5.1 and having trouble with cms.enableReload. 
> Despite the fact that it is injected into my resource type, I don't 
> see the resource-type appearing. The script works when run standalone 
> outside of OpenCMS.
>
> <%@page buffer="none" session="false" trimDirectiveWhitespaces="true"%>
> <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms 
> <http://www.opencms.org/taglib/cms>"%>
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core 
> <http://java.sun.com/jsp/jstl/core>"%>
> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt 
> <http://java.sun.com/jsp/jstl/fmt>"%>
> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions 
> <http://java.sun.com/jsp/jstl/functions>"%>
> <%@ taglib prefix="elx" uri="/WEB-INF/taglib/elixir.tld"%>
> <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql 
> <http://java.sun.com/jsp/jstl/sql>" %>
>
> <cms:formatter var="content" val="chart">
> <jsp:useBean id="db" class="com.elixirtech.opencms.DBConfig" />
>
> <sql:setDataSource var="spv2" driver="${db.driver}"
> url="${db.url}"
> user="${db.user}"  password="${db.password}"/>
>
> <sql:query dataSource="${spv2}" var="prices">
> ${db.query}
> </sql:query>
> <c:set var="options" value="..."/>
> <c:set var="data" value="..."/>
>
> <div class="margin-bottom-30">
> <c:set var="svg" value="img-${cms.element.id <http://cms.element.id/>}"/>
> <c:if test="${cms.edited}">
> <!-- enforce an automatic reload, when the content is edited or
> moved to another container -->
> ${cms.enableReload}
> </c:if>
> <div id="${svg}"></div>
> <script>
> ...
> </script>
> </div>
> </cms:formatter>
>
> When I insert the content, the screen flashes and then the content 
> disappears. Do I need to do anything additional to make sure the 
> content shows?
>
> Regards,
> Clement Wee
> Singapore
>
> On Tue, May 2, 2017 at 11:37 PM, Clement Wee <clement at elixirtech.com 
> <mailto:clement at elixirtech.com>> wrote:
>
>     Hi guys,
>
>     I am using OpenCMS 10.5.1 and having trouble with
>     cms.enableReload. Despite the fact that it is injected into my
>     resource type, I don't see the resource-type appearing. The script
>     works when run standalone outside of OpenCMS.
>
>     <%@page buffer="none" session="false"
>     trimDirectiveWhitespaces="true"%>
>     <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms
>     <http://www.opencms.org/taglib/cms>"%>
>     <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core
>     <http://java.sun.com/jsp/jstl/core>"%>
>     <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt
>     <http://java.sun.com/jsp/jstl/fmt>"%>
>     <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions
>     <http://java.sun.com/jsp/jstl/functions>"%>
>     <%@ taglib prefix="elx" uri="/WEB-INF/taglib/elixir.tld"%>
>     <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql
>     <http://java.sun.com/jsp/jstl/sql>" %>
>
>     <cms:formatter var="content" val="chart">
>     <jsp:useBean id="db" class="com.elixirtech.opencms.DBConfig" />
>
>     <sql:setDataSource var="spv2" driver="${db.driver}"
>     url="${db.url}"
>     user="${db.user}"  password="${db.password}"/>
>
>     <sql:query dataSource="${spv2}" var="prices">
>     ${db.query}
>     </sql:query>
>     <c:set var="options" value="..."/>
>     <c:set var="data" value="..."/>
>
>     <div class="margin-bottom-30">
>     <c:set var="svg" value="img-${cms.element.id
>     <http://cms.element.id>}"/>
>     <c:if test="${cms.edited}">
>     <!-- enforce an automatic reload, when the content is edited or
>     moved to another container -->
>     ${cms.enableReload}
>     </c:if>
>     <div id="${svg}"></div>
>     <script>
>     ...
>     </script>
>     </div>
>     </cms:formatter>
>
>     When I insert the content, the screen flashes and then the content
>     disappears. Do I need to do anything additional to make sure the
>     content shows?
>
>     Regards,
>     Clement Wee
>     Singapore
>
>
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20170503/5dec068c/attachment.htm>


More information about the opencms-dev mailing list