cancel
Showing results for 
Search instead for 
Did you mean: 

JS in product cockpit

Former Member
0 Kudos

Does anyone have a chance to use external javascript libraries in zul files on widgets in productcockpit?

or in any related to *.zul files in zkoss 3.x framework ?

I tried to use it in such way: myWidget.zul

  <include src="/trailcockpit/js/test.zul" visible="true"/>

test.zul

 <?xml version="1.0" encoding="UTF-8"?>
 <div visible="false" use="de.hybris.platform.cockpit.components.CustomCsaIncludeHelper">
     <html>
     <![CDATA[
     <script type="text/javascript">
     function works(){
         alert("JS works")
     }
     </script>
 ]]>
     </html>
 </div>

But! after first trying of execution I get Error: than I press redraw button after this I trying execute it againe - and its works

But I cant understood: how avoid first part:(

Accepted Solutions (1)

Accepted Solutions (1)

RaufAliev
Participant
0 Kudos

I had the same challenge. Please look through my article about integrating the external javascript code (cropping images) with Product cockpit:

https://hybrismart.com/2016/08/23/image-crop-resize-in-product-cockpit/

In short:

  • Product cockpit is a single page application. The external javascript is always a pain when you integrate it with any SPA including ZK.

  • Hybris Product Cockpit is based on ZK 3.6.4. The architecture of ZK Framework 3.6.4 is not compatible with Javascript modules (by the way, 3.6.4 was released 7 (!) years ago). The last versions are better, but ... see #1. You need to redesign and rewrite the modules completely to make them pluggable to ZK.

  • there is a workaround: using iframe and pop-up windows. See the link above for the details

Former Member
0 Kudos

I know the way to customize this throw the index.zul 🙂 (add references to js in the file system and then use it in wizards), but as I heard it is allowed only if you have a license of ZK Framework

Answers (0)