Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3011

zhtml img src ignored before added to page

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.0.1
    • 8.0.0
    • ZHTML
    • Security Level: Jimmy
    • ZK 8.0.1 S2

      when setting the src attribute of an xhtml component before it is added to a page will ignore it and default to "", losing the src url

      <zk xmlns:x="xhtml">
      	<div id="container">
      	</div>
      	<zscript><![CDATA[
      		import org.zkoss.zhtml.Img;
      		Img img = new Img();
      		img.setDynamicProperty("src", "/some/url.jpg");
      		img.setParent(container);
      
      		//workaround: set the src after adding the component
      		//img.setDynamicProperty("src", "/some/url.jpg");
      	]]></zscript>
      </zk>
      

      Workaround

      set the src attribute after setting the parent
      or use the Image component:
      org.zkoss.zul.Image which supports setting the src before appending the component correctly

            wenninghsu wenninghsu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours
                6h