Change value of Th:with parent variable

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Change value of Th:with parent variable

Miquel
Hi,

I want to change the value of a variable defined in a parent tag:

<div th:with="downloadScript = false">
   ...
   <div th:switch="${itemType}">
      <div th:case="downloadTag">
          <div th:with="downloadScript = true" />
          ...
      </div>
   </div>

   <script type="text/javascript" th:inline="javascript" th:if="${downloadScript == true}"> .... </script>
</div>

The above example does not work, "downloadScript" variable is redefined again in the new scope.

There is a way to change the "global" downloadScript variable value to true?

Thanks,
Reply | Threaded
Open this post in threaded view
|

Re: Change value of Th:with parent variable

Hiral Vora
Hi,
I am facing the same issue and I am not able to find the solution anywhere.
Did you resolve your issue?