Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    HTMLPane reference to javascript libraries not working

    Hi, I seem to be missing a trick with the HTMLPane. I am sure its something silly that I need to set but for some reason the javascript files I need to reference are not being found (or at least thats how it appears.).

    I am passing in an HTML string (that renders perfectly outside of the HTMLPane), it references external javascript files as usual like so.
    Code:
    <script src="js/formatter.js"></script>
    I must assume that at the time the HTML is being rendered the path pointer is not at the root or something but I have tried a few things like adding ../ and ../../ etc to the path to get it to render correctly and nothing makes any difference. The js is obviously not running.

    I use the SMARTGWT showcase as a template which is why I am confused as to why it just wont work. There is nothing in the console to indicate an error either.

    any pointers would be much appreciated.

    thanks
    Paul

    #2
    Hi, I am really confused by what I am seeing in the HTMLPane with regards to using javascript libraries, I would rally appreciate some help if there is any to be had on the topic.
    I have managed to verify that the pointers to the libraries are being resolved correctly (by making them incorrect and seeing errors). the HTML included below works perfectly in a browser in its own right, but in an HTMLPane I just get the values inside the XML. The script doesnt appear to work at all. If I pass the HTMLPane a contentURL with that HTML it works perfectly as well. But if I pass it in using setContents() (I need to since the content of <textarea> is dynamic) the javascript doesnt appear to run or it has no afect on the output.

    Version and Browser: SMARTGWT version 2.5 on Google Chrome (latest Build)and internet explorer 9

    Console Log: The developer console doesnt register any errors to report. it just outputs by debug statement which simply had the DOM for the HTMLPane


    Code:
    <link rel="stylesheet" href="../js/sh/SyntaxHighlighter.css"	type="text/css">
    <style>
    .dp-highlighter {
    	white-space: nowrap;
    	overflow: visible;
    	width: 600px;
    	font-size: 11px;
    	font-family: Courier New, monospace;
    }
    </style>
    			<script type="text/javascript" src="../js/sh/shCore.js"></script>
    			<script type="text/javascript" src="../js/sh/shBrushXml.js"></script>
    			<textarea class="xml:nogutter" name="xmlMessage" rows="15" cols="120"><?xml version="1.0" encoding="UTF-8"?><PromoMonMsg>abcdef</PromoMonMsg></textarea>
    			<script class="javascript">
    				dp.SyntaxHighlighter.HighlightAll('xmlMessage')
    			</script>
    any assistance would be much appreciated

    thanks
    Paul
    Last edited by pmbsa; 10 Oct 2011, 05:13.

    Comment


      #3
      setContents() doesn't execute script blocks because the assumption is that you can execute them yourself in this case. However we are planning an enhancement in 3.0 to allow you to enable execution of script blocks with setContents().

      Comment


        #4
        Hi, thanks for the response...I am pretty much a newb here thow with what I have in my HTMLPane could you possibly give me an example of how that would work?(Running them myself that is).

        thanks
        Paul

        Comment


          #5
          Is this script execution in place in the nightly build today?

          Comment


            #6
            No, this did not make 3.0 per se - should have clarified that we intend this for somewhere in 3.x, not 3.0 as such. You guys have some consulting hours stored up if you need this to happen right away.

            Comment

            Working...
            X