Announcement

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

    Layout.create not possible in page head

    Hi,
    A small thing. It seems that I can't create a Layout in my javascript loaded in the head of the html page,
    I try this:

    <script>
    var tst = isc.VLayout.create({autoDraw: false});
    </script>

    I get this error:
    Error: Attempt to write content into a page outside the BODY tag. Isomorphic SmartClient requires this tag be present and all widgets be written out inside it.
    Please ensure your file has a BODY tag and any code to draw SmartClient widgets is enclosed in this tag.

    After some debugging/checking it seems that the Layout.initWidget calls setLayoutMargin which draws html elements.

    gr. Martin

    #2
    We're not seeing this from a simple test...
    Can you show us a simple standalone complete HTML page that causes this error? Also - which browser/OS are you seeing this on?

    Thanks

    Comment


      #3
      Hi,
      See below the html page, I tested this with the nightly build of yesterday.
      Code:
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      <html>
      <head>
      <meta http-equiv="Content-type" content="text/html;charset=utf-8"/>
      <script>var isomorphicDir='isomorphic/';</script>
      <script src="isomorphic/system/modules/ISC_Core.js"></script>
      <script src="isomorphic/system/modules/ISC_Foundation.js"></script>
      <script src="isomorphic/system/modules/ISC_Containers.js"></script>
      <script src="isomorphic/system/modules/ISC_Grids.js"></script>
      <script src="isomorphic/system/modules/ISC_Forms.js"></script>
      <script src="isomorphic/system/modules/ISC_DataBinding.js"></script>
      <script src="isomorphic/skins/Enterprise/load_skin.js"></script>
      <script>
      isc.setAutoDraw(false);
      var tst = isc.VLayout.create({autoDraw: false});
      </script>
      </head>
      <body>
      </body>
      </html>
      gr. Martin

      Comment


        #4
        Thanks for the sample code
        Yes - we see the bug now and we'll be looking into how best to resolve this for the future.

        In the meantime a simple workaround would be to take the Layout definition out of the page's head of course.

        If you must have it there, another option would be - rather than defining your VLayout directly in the script loaded in the 'head' of your HTML page, you could define a getter function that will build your UI / create the layout when it is required.

        Comment


          #5
          Thanks for looking into it, yes that's how I solve it now.

          Does Isomorphic have a bug tracking system to which we can subscribe (either public or only for paying users)?

          gr. Martin

          Comment


            #6
            On further investigation, creating and drawing components in the <head> is not supported, and the problem here was that there is supposed to be a clear warning about this but it was broken.

            Creation of components in the <head> area of the document can't be supported because components need the ability to create elements in the <body> area in order to answer basic questions about how large they will draw.

            Comment

            Working...
            X