Can't get collection to bind to datalist

I can get the data and it is properly formatted json but I can't seem to make the binding work correctly. Here is the full source code:

enyo.kind({
name: "ListUsers",
kind: "FittableColumns",
fit: true,
classes: "enyo-fit",
published: {
collection: null
},
components:[
{kind: "FittableRows", components: [
{name: "repeater", kind:"enyo.DataList", fit:true, components: [
{components: [
{name:"firstName"}
], bindings: [
{from: ".model.firstName", to: ".$.firstName.content"}
]}
]}
]}
],
bindings: [
{from: ".collection", to: ".$.repeater.collection"}
],
users : '',
create: enyo.inherit(function (sup) {
return function () {
sup.apply(this, arguments);
this.getUsers();
};
}),
getUsers: function(inSender,inEvent) {
var request = new enyo.Ajax({
url: "http://atxapps.com/_sites/atxapps.com/dev/jetstream/assets/dataUsers.json",
method: "GET",
handleAs: "json"
});
request.response(this,"processUsers");
request.go();
},
processUsers: function(inSender, inResponse){
if (!inResponse) {
return;
}
this.set("collection", inResponse.users);
}
});
Any help is greatly appreciated.

Comments

  • You need to set the value of collection to be an instance of enyo.Collection, i.e. in your processUsers method:
    
    this.set("collection", new enyo.Collection(inResponse.users));
    
  • I just tried that and it now is an instance of an enyo.Collection, but it is still not displaying the first name of the users. Could there be something wrong in my repeater components and subsequent bindings?
  • Guessing it's rendering the DataList with 0 height and therefore not rendering any items. Even thought you've set fit:true on it, it's container has a natural height of 0 so it has no height. Try adding the enyo-fit class to the FittableRows instance.
  • heck yeah now we are cooking with butter!!! Thanks man! You guys are good at this stuff!
  • mmm ... butter ...
Sign In or Register to comment.