Should I give up trying to use Enyo ?

edited May 2013 in Newbie Questions
Hello

After two days of trying to do without any success pretty simple things that I have been able to do very easily in two hours using JQM, I am about to give up ENYO.

Last chance is this forum. I just want to display a simple list:
enyo.kind({
    name: "App",
    fit: true,
    components: [
        {
            kind: "ProductList"
        }
    ],
    create: function () {
        this.inherited(arguments);
    }
});

enyo.kind({
    name: "ProductList",
    fit: true,
    components: [
        {
            name: "list",
            kind: "List",
            fit:true,
            count: 200,
            onSetupItem: "setupItem",
            components: [
                {classes: "ListItemContainer", components: [
                        {
                            name: "productName",
                            content: "test content"
                        },
                        {
                            name: "productDescription"
                        }
                    ]}
            ]
        }
    ],
    create: function() {
        this.inherited(arguments);
    },
    setupItem: function (inSender, inEvent) {
        this.$.productName.setContent("test" + Math.random());
        this.$.productDescription.setContent("Description " + Math.random());
        return true;
    }
});
setupItem is NEVER called. Why ?
Same thing if I put it in the App Kind...

Thanks... But... Well...

Comments

  • Seems to be working perfectly here: http://jsfiddle.net/sugardave/YmFFX/

    I just copied your source and re-formatted it to read it better.
  • Thank you for your reply, SugarDave

    Using cordova .7.0, Windows 8 and Visual Studio 2012. create() is called but setupItem, never. Does not run in the browser either (IE, Chrome). Removing cordova does not help.
  • edited May 2013
    I'm a newbie too so perhaps I'm wrong but I had to set the list's size to make it works...
    something like
    this.$.list.setCount(10);
  • @opolette, as @sugardave commented, your code is perfectly right. Maybe you're not rendering the app?

    new App().renderInto(document.body);
  • @FlexOnMobile: Flex is great. Too bad Adobe has not understood that...
    Concerning your point: where would you put the setcount?
    @rafa_bernad : yes I did. As said, create() gets called.

    Thanks both for your replies
  • edited May 2013
    Well, as soon as you initialize the object, create() is called, but that doesn't mean you've rendered it:

    var myApp = new App();

    Doesn't make any changes to the DOM, but creates an object, so create() gets called.

    Again, your code is right, and it should work as expected.
  • Here is the code of my index.html

    <!DOCTYPE html>
  • Are you getting any errors in the console? Have you tried seeing if you can get the default bootplate app to render?
  • Are you using Enyo 2.2 or nightly? I know that earlier versions of Enyo didn't work as Win8 apps because of use of unsafe calls that the Win8 HTML runtime doesn't support.
  • @chrisvanhooser
    Good point! Yes we have something here: no constructor found for kind "List"
    I tried to include the package.js (thinking the layout lib might not be included) but I get this wonderful "0x800c001c - JavaScript runtime error:" error (Windows 8 / IE10 security) line 158 of enyo.js (R 2.2).
    So I replaced the block of the script function by
    
    script: function(e, t, n) {
        enyo.execUnsafeLocalFunction(function () {
            if (!enyo.runtimeLoading) document.write('"); else {
                var r = document.createElement("script");
                r.src = e, r.onload = t, r.onerror = n, document.getElementsByTagName("head")[0].appendChild(r);
            }
        });
    },
    
    and it works...

    Has it been forgotten by the ENYO team?
  • You have to use a minified/deployed version of Enyo to make a Win8 app. The script loader WILL NOT work in the app.
Sign In or Register to comment.