I’m trying to create a controller for a custom complex object but have some problems with nested list biding.
I have a json datastore which gets following data structure:
var data = [
{
id: 1,
name: 'check all links if they work',
description: 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.',
tags: ['a', 'b', 'c']
},
{
id: 2,
name: 'check all titles',
description: 'Maecenas sed diam eget risus varius blandit sit amet non magna.',
tags: ['a', 'b', 'c']
},
{
id:3,
name: 'check layout in all browsers',
description: 'Maecenas sed diam eget risus varius blandit sit amet non magna.',
tags: ['a', 'b', 'c']
},
{
id:4,
name: 'validation if videos works fine',
description: 'Maecenas sed diam eget risus varius blandit sit amet non magna.',
tags: ['a', 'b', 'c']
}
];
What I would like to do: is to bind this list to a ui list with custom list items and bind nested ‘tags’ list as a property to a custom ui control that displays a list of tags.
controllerCase.setDelegate({
configureItem : function(item) {
},
createItem : function() {
return new my.custom.Item();
},
bindItem : function(controller, item, id) {
controller.bindProperty("", "model", null, item, id);
controller.bindProperty("name", "name", null, item, id);
controller.bindProperty("description", "description", null, item, id);
controller.bindProperty("tags", "tags", null, item, id);
});
I would like to bind ‘tags’ property of my.custom.Item to ‘tags’ property in model but aways get an empty array.
As Martin suggested, methods from data array class should be used. See a comment under the question.