Sha256: d001c5e43d07a91dab1fe03c4aace286e10e1e47e53581f9f05b86a0c65c3b26

Contents?: true

Size: 1.65 KB

Versions: 3

Compression:

Stored size: 1.65 KB

Contents

function ReportsDataTables(reports) {
    this.reports = reports;
}

ReportsDataTables.prototype.build = function(data, id, wrapper) {
    log.debug('Building dataTable for id ' + id);
    log.trace(data);

    var dataTableWrapper = $('<div class="dataTableWrapper" id="dataTableWrapper-' + id + '"><h3>' + data['name'] + '</h3></div>');
    wrapper.append(dataTableWrapper);

    var dataTable = $('<table cellpadding="0" cellspacing="0" border="0" class="display" id="dataTable-' + id + '"></table>');
    dataTableWrapper.append(dataTable);

    var aaData = [];
    for (var i in data['values']) {
        aaData.push([data.values[i]['x'], data.values[i]['y']])
    }

    dataTable.dataTable({
        "aaData": aaData,
        "aoColumns": [
            { "sTitle": "Date" },
            { "sTitle": "Value" },
        ]
    });
}

ReportsDataTables.prototype.buildTable = function(data, wrapper) {
    var id = data['name'];
    var dataTableWrapper = $('<div class="dataTableWrapper" id="dataTableWrapper-' + id + '"></h3></div>');
    wrapper.append(dataTableWrapper);

    var dataTable = $('<table cellpadding="0" cellspacing="0" border="0" class="display" id="dataTable-' + id + '"></table>');
    dataTableWrapper.append(dataTable);

    var aaData = [];
    for (var i in data['values']) {
        aaData.push(data['values'][i])
    }

    var aoColumns = [];
    for (var i in data['header']) {
        aoColumns.push({ "sTitle": data['header'][i] })
    }

    dataTable.dataTable({
        "aaData": aaData,
        "aoColumns": aoColumns
    });
}

ReportsDataTables.prototype.buildCSVURL = function(position) {
    return this.reports.buildDataURL(position, 'csv');
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kanaui-0.6.0 app/assets/javascripts/kanaui/reports.dataTables.js
kanaui-0.5.1 app/assets/javascripts/kanaui/reports.dataTables.js
kanaui-0.5.0 app/assets/javascripts/kanaui/reports.dataTables.js