Da ich lieber Tables verwenden, ich DJ Martin-Lösung wie so angepasst:
Set Tisch html:
<table class="table table-condensed table-hover table-striped" id="dc-data-table">
<thead>
<tr class="header">
<th>Day</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<th></th>
<th></th>
</tfoot>
</table>
Stellen Sie Ihre Tables Optionen:
var dataTableOptions = {
"lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "All"] ],
"footerCallback": function (row, data, start, end, display) {
var api = this.api(), data ;
var total = ndx.groupAll().reduceSum(function (d) { return d.amount }).value() ;
// Update footer
$(api.column(1).footer()).html(
currencyFormat(total)
) ;
},
"order": [[1, 'desc']],
"dom": 'T<"clear-l"l><"clear-l"i><"clear-r"f><"clear-r"p>t',
"tableTools": {
"sSwfPath": "copy_csv_xls_pdf.swf"
},
columnDefs: [{
targets: 0,
data: function (d) {
return d3.time.format('%Y-%m-%d')(d.first_request) ;
}
}, {
targets: 1,
data: function (d) {
return currencyFormat(d.amount) ;
}
}
]
} ;
Tables Instanz erstellen:
var datatable = $('#dc-data-table').dataTable(dataTableOptions) ;
einmal
function RefreshTable() {
dc.events.trigger(function() {
datatable.api()
.clear()
.rows.add(tableDimension.top(Infinity))
.draw() ;
});
}
for (var i = 0; i < dc.chartRegistry.list().length; i++) {
var chartI = dc.chartRegistry.list()[i];
chartI.on("filtered", RefreshTable);
}
RefreshTable() ;
Anruf Refresh() Anfangsdaten zu laden, und machen alle Diagramme:
erstellen Refreshfunktion und fügen zu Diagrammen
RefreshTable() ;
dc.renderAll() ;
Thank you very much. +1 vote :) – user3206082
Was ist der Unterschied zwischen jquery dataTables und dynaTables? – user3206082
Sie sind beide Plugins für jquery.Ich mag dynatable, weil die Syntax ist schöner und es ist einfacher zu ändern, wie die Dinge gerendert werden. Überprüfen Sie http://www.dynatable.com/ –