render into vs write

edited December 2012 in Newbie Questions
Starting work with enyo and phonegap together for the first time. I've essentially duplicated my enyo based web page. The page has a date picker and works great. Going through the documentation here, it says I need to use new app().renderInto(document.body) instead of new app().write() when working with phonegap. When I do that, the picker dates appear below the group box that is containing the picker, like some kind of css strangeness or something. Using new app().write(); renders just like the enyo sampler. Is using .write() going to cause problems as I build the project out?
        <script type="text/javascript">
        // tell Enyo to listen for deviceready event
        enyo.dispatcher.listen(document, "deviceready");

        // Application kind
        enyo.kind({
            name: "App",
            kind: "FittableRows",
            components: [
                {kind: "Signals", ondeviceready: "deviceReady"},
                {kind: "onyx.Groupbox", components: [
                    {kind: "onyx.GroupboxHeader", allowHtml: true, content: "<center>Header Info </center>"},
                    {components: [
                        {kind: "FittableColumns", components: [
                            {allowHtml: true, content: "<center><h5>Data for: </h5>"},                       
                            {allowHtml: true, kind: "onyx.DatePicker", floating: true, onSelect: "updateDateValues", name:"datePicker", minYear: 2010},
                        ]},
                    {allowHtml: true, name: "messagearea"}
                    ]},
                ]},
            ],
            
            deviceReady: function() {
                // respond to deviceready event
                this.getToday();
            },

Comments

  • In general, renderInto works better and will be supported in runtime environments, like Windows 8 apps or Chrome apps that don't support write(). It's likely that you're hitting the behavior that renderInto(document.body) automatically adds enyo-fit styles to the item that's rendered. To avoid this, have a div in your body and render into that tag.
  • Turns out that I had my script in the body and not the head of the document. Put it in the head and now I can render into the body or the div. Thanks for the help.
Sign In or Register to comment.