Multi year report move to AJAX.

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
James Cole
2016-11-02 20:08:11 +01:00
parent 2ddd4314f1
commit e24f5ec9f3
15 changed files with 267 additions and 272 deletions

View File

@@ -128,4 +128,33 @@ function respondInfoButton(data) {
$('#defaultModal').empty().html(data.html);
$('#defaultModal').modal('show');
}
function loadAjaxPartial(holder, uri) {
"use strict";
console.log('Going to grab URI ' + uri);
$.get(uri).done(function (data) {
displayAjaxPartial(data, holder);
}).fail(function () {
failAjaxPartial(uri, holder);
});
}
function displayAjaxPartial(data, holder) {
"use strict";
console.log('Display stuff in ' + holder);
var obj = $('#' + holder);
obj.removeClass('loading').html(data);
// call some often needed recalculations and what-not:
// find a sortable table and make it sortable:
$.bootstrapSortable(true);
}
function failAjaxPartial(uri, holder) {
"use strict";
console.log('Failed to load' + uri);
$('#' + holder).removeClass('loading').addClass('general-chart-error');
}

View File

@@ -1,13 +1,13 @@
/* globals google, startDate ,reportURL, endDate , reportType ,accountIds , picker:true, minDate, year, month, columnChart, lineChart, stackedColumnChart */
/* globals budgetMultiUrl, accountIds */
$(function () {
"use strict";
drawChart();
loadAjaxPartial('budgetMultiYear', budgetMultiUrl);
});
function drawChart() {
"use strict";