Created
February 6, 2017 20:32
-
-
Save dranney-sugarcrm/ce9b3d2dc98cf696495e4f1a626ed45e to your computer and use it in GitHub Desktop.
Call API to populate data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
... | |
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