Skip to content

Instantly share code, notes, and snippets.

@dranney-sugarcrm
Created February 6, 2017 20:32
Show Gist options
  • Save dranney-sugarcrm/ce9b3d2dc98cf696495e4f1a626ed45e to your computer and use it in GitHub Desktop.
Save dranney-sugarcrm/ce9b3d2dc98cf696495e4f1a626ed45e to your computer and use it in GitHub Desktop.
Call API to populate data
({
...
loadData: function() {
var self = this;
var url = app.api.buildURL('Accounts/get_line_chart_data');
app.api.call('read', url, null, {
success: function (response) {
_.each(response, function (data, key) {
self.chartDataArr.push(data);
});
if (self.chartDataArr.length > 0) {
self.total = 1;
} else {
self.errorMsg = "There is no chart information available";
}
self.render();
},
error: _.bind(function () {
this.errorMsg = "Error encountered retrieving chart information";
}, this)
});
},
...
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment