Hi
Can someone provide me with an example code showing how to bind the makerequest with a tableview.
I am struggling , can’t get it to work.
THis is what is have so far. I am using the Alloy framework
//GET DATA
//*** NOTE : If you run these in the same controller you’ll only need to do the following line once.
var Promise = require(‘Promise’);
var dreamfactory = require(‘dreamfactory’);
dreamfactory.makeRequest(“GET”, “/system/user”).then(function(response) {
Ti.API.info(response.record);
var people = JSON.parse(response.record);
var items = [];
_.each(people, function(person) {
items.push({
first_name : {
text : person.first_name
},
last_name : {
text : person.last_name
}
});
});
Ti.API.info(items);
$.elements.setItems(items);
}, function(error) {
Ti.API.info(error);
});
View is this
<Window class="container" title="Planner List" id="plannerlist" >
<ListView id="elementsList">
<Templates>
<ItemTemplate name="template1" id="template1">
<View id="lstTemplateView" layout="vertical">
<Label bindid="first_name" id="first_name"></Label>
<Label bindid="last_name" id="last_name"></Label>
</View>
</ItemTemplate>
</Templates>
</ListView>
<Widget src="nl.fokkezb.loading" id="loading" />
</Window>