-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I would like to create a new mold for the Datebox component. Is this possible without creating a new widget that extends zul.db.Datebox?
I have tried creating a mold by adding mymold.js to /web/js/zul/db/mold/mymold.js and registering it in lang-addon.xml with the following:
<component>
<component-name>datebox</component-name>
<component-class>org.zkoss.zul.Datebox</component-class>
<extends>datebox</extends>
<mold>
<mold-name>mymold</mold-name>
<mold-uri>mold/mymold.js</mold-uri>
</mold>
</component>
But when I use the component with mold="mymold" I get an error saying "Mold mymold not found in zul.db.Datebox". If I use a mold name not defined (for example mold="unknownmold") I get an error saying "org.zkoss.zk.ui.UiException: Unknown mold: unknownmold.; allowed: [mymold, default, rounded]".
Hi Bobo,
your example looks alright, I did almost the same and it worked, so it might be that your mold-JS file is not available on the classpath during runtime.
<component>
<component-name>datebox</component-name>
<!-- no need to redefine the Component class -->
<extends>datebox</extends>
<mold>
<mold-name>mymold</mold-name>
<mold-uri>mold/datebox-my.js</mold-uri>
<css-uri>css/calendar.css.dsp</css-uri>
</mold>
</component>
and I put my mold script into my project's classpath (just make sure it is somewhere in the classpath)
/src/main/java/web/js/zul/db/mold/datebox-my.js
or /WEB-INF/classes/web/js/zul/db/mold/datebox-my.js
function(out) {
out.push("hello!");
zul.inp.ComboWidget.$redraw.apply(this, arguments);
}
Please let me know if this does not solve your issue.
Regards,
Robert
Asked: 2013-11-20 10:21:52 +0800
Seen: 61 times
Last updated: Nov 27 '13
composite component help [closed]
EL in a forEach @command not working?
Different template for each grid row
Cardlayout animation is broken
Grid RowRender slow using 6.5.1 and sizable=true
setVisible(false), component will load or not
Decimalbox and doublebox value rounded on iPad
history management with page status