No html displayed in dojo mobile contentpane using href parameter

Go To StackoverFlow.com

0

i'm trying to implement dojox.mobile.ContentPane to parse content from html. But, no text is displayed at all. Here is my html to file to parsed by dojox.mobile.ContentPane (filename: fragment1.html):

<div data-dojo-type='dojox.mobile.RoundRect' shadow='true'>
  HTML fragment example
</div>

And here is my index.html :

<!DOCTYPE html>
<html>
    <head>
        <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <title>dojox/mobile Demo</title>
        <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.js" data-dojo-config="async: true"></script>
        <script type="text/javascript">

            require(["dojox/mobile/parser", "dojox/mobile", "dojox/mobile/deviceTheme", "dojox/mobile/compat", "dojo/domReady!","dojox/mobile/ContentPane", "dojox/mobile/RoundRect", "dojox/mobile/RoundRectCategory"], function(parser) {
                parser.parse();
            });

        </script>
    </head>
    <body>

        <div id="main" data-dojo-type="dojox.mobile.View" data-dojo-props="selected: true">
            <h1 data-dojo-type="dojox.mobile.Heading">Main Menu</h1>
            <ul data-dojo-type="dojox.mobile.RoundRectList">
                <li data-dojo-type="dojox.mobile.ListItem" data-dojo-props="moveTo: 'view-content'">
                    View Content
                </li>               
        </div>

        <div id="view-content" data-dojo-type="dojox.mobile.View">
            <h1 data-dojo-type="dojox.mobile.Heading" data-dojo-props="back:'Main Menu', moveTo:'main'">This is sample content</h1>
            <h2 data-dojo-type="dojox.mobile.RoundRectCategory">Pane1</h2>
            <div id="pane1" data-dojo-type="dojox.mobile.ContentPane" content="&lt;div data-dojo-type='dojox.mobile.RoundRect' shadow='true'&gt;Thank you!&lt;/div&gt;"></div>

            <h2 data-dojo-type="dojox.mobile.RoundRectCategory">Pane2</h2>
            <div id="pane2" data-dojo-type="dojox.mobile.ContentPane" href="fragment1.html"></div>
        </div>

    </body>
</html>

Is anyone have solutions? Thanks.

2012-04-04 03:28
by rahmat
rahmat : regarding debug, read http://dojotoolkit.org/documentation/tutorials/1.7/dojo_config - Sebastian Lasse 2012-05-10 13:44


0

Your fragment looks very similar to the documentation! I think what's going on here is that your parser.parse() line probably gets executed too early; before the external HTML content has been fetched by the ContentPane widget and inserted into the DOM. Have you tried using a debugger to see what's actually in the DOM when this is loaded? What's in the console?

Irrespective, I think you may need to turn on the parseOnLoad: true property on the ContentPane (see the docs). Looks like that will do what you want.

2012-04-26 21:05
by Andrew Ferrier
thanks for your answer @andrew-ferrier. Anyway, as a beginner i have a question. How do I debug dojo script - rahmat 2012-05-08 09:42
Ads