Created
February 16, 2018 22:45
-
-
Save Extarys/88db0409ca0215f638e1d13bc51e4e50 to your computer and use it in GitHub Desktop.
DataTable hanging on huge dataset
This file contains 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
$("#explore").html('<table class="table no-footer" id="all-tracks"></table>'); | |
allTrackDataTable = $('#all-tracks').DataTable({ | |
columns: [ | |
{ "title": "Title", "data": "title", "width": "250px" }, | |
{ "title": "Album Artist", "data": "albumartist", "width": "250px", "orderData": [1, 3, 2] }, | |
{ "title": "Artist", "data": "artist", "width": "250px", "orderData": [2, 3] }, | |
{ "title": "Album", "data": "album", "width": "250px" }, | |
{ "title": "BPM", "data": "bpm", "type": "num" }, | |
{ "title": "Compilation", "data": "compilation", "visible": false }, | |
{ "title": "Date", "data": "date", "visible": false }, | |
{ "title": "Year", "data": "year", "type": "date" }, | |
{ "title": "Disk", "data": "disk", "render": function ( data, type, row, meta ) { | |
return data.no; | |
}}, | |
{ "title": "Track", "data": "track", "render": function ( data, type, row, meta ) { | |
return data.no; | |
}}, | |
{ "title": "Genre", "data": "genre" }, | |
{ "title": "Bits Per Sample", "data": "bitsPerSample", "type": "num-fmt" }, | |
{ "title": "Loseless", "data": "loseless", "visible": false }, | |
{ "title": "Channels", "data": "numberOfChannels", "visible": false }, | |
{ "title": "Duration", "data": "duration", "render": function ( data, type, row, meta ) { | |
var min = Math.floor(data / 60); | |
var sec = Math.floor(data - (min * 60)); | |
return min + ":" + sec; | |
}}, | |
{ "title": "Sample Rate", "data": "sampleRate", "type": "num-fmt" }, | |
{ "title": "Label", "data": "label" }, | |
{ "title": "Media", "data": "media" }, | |
{ "title": "Barcode", "data": "barcode" }, | |
{ "title": "Catalog #", "data": "catalognumber" }, | |
{ "title": "Path", "data": "src" }, | |
{ "title": "Rating", "data": "rating", "render": function ( data, type, row, meta ) { | |
return '<div class="jrating" data-rating="'+data+'"></div>'; | |
}}, | |
{ "title": "Play Count", "data": "playcount", "render": function ( data, type, row, meta ) { | |
return data; | |
}}, | |
{ "title": "Last played", "data": "lasttimeplayed", "render": function ( data, type, row, meta ) { | |
return data; | |
}}, | |
], | |
paging: true, | |
processing: false, | |
deferRender: true, | |
info: false, | |
bPaginate: false, | |
searching: false, | |
scrollX: true, | |
scrollCollapse: true, | |
scrollY: '80%', | |
colReorder: true, | |
rowReorder: false, | |
data: tracks, | |
"order": [[1, "asc"], [3, "asc"], [9, "asc"]], | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment