Mapping typedef's to visuals

Ok, so nested objects werent working, but they should now, this is the test i was using:

typedef SomeItem = {
    var name:String;
    var completed:Bool;
    var age:Int;
    var sub:SubObject;
}

typedef SubObject = {
    var something:String;
    var somethingElse:Int;
}

Then:

            var ds = new ListDataSource<SomeItem>();
            var lv1 = main.findComponent("lv1", ListView);
            for (i in 0...10) {
                var item1:SomeItem = {
                    name: "Name " + i,
                    completed: i % 2 == 0,
                    age: 100 + i,
                    sub: {
                        something: "Something " + i,
                        somethingElse: 200 + i
                    }
                }
                ds.add(item1);
            }
            lv1.dataSource = ds;

And finally, this is my item renderer:

    <listview id="lv1" width="400" height="200">
        <item-renderer layoutName="horizontal" width="100%">
            <checkbox id="completed" />
            <label id="name" width="100%" />
            <label id="something" />
        </item-renderer>
    </listview>

image

Any thoughts on this? Also, im not sure what the best way would be to handle arrays in the data… Say you had “someArray” somewhere in the typedefs… how would that map to the UI? Im not sure myself so open to suggestions :slight_smile:

Cheers,
Ian

PS: you’ll need to pull latest master for the current changes

1 Like