Reusable datatable control that hooks up to any of our REST APIs

* Implements item selection (single, shift, ctrl), pagination, and
  sorting. To be used in the future.
* Added example code for how to use the table widget
* Temporarily added a table test page to the DashboardController
This commit is contained in:
Albert Santoni 2015-09-15 14:18:35 -04:00
parent 2d2ed25fcc
commit ffdc83dc26
7 changed files with 411 additions and 21 deletions

View file

@ -0,0 +1,24 @@
/**
* Created by asantoni on 11/09/15.
*/
$(document).ready(function() {
var aoColumns = [
/* Title */ { "sTitle" : $.i18n._("Title") , "mDataProp" : "track_title" , "sClass" : "library_title" , "sWidth" : "170px" },
/* Creator */ { "sTitle" : $.i18n._("Creator") , "mDataProp" : "artist_name" , "sClass" : "library_creator" , "sWidth" : "160px" },
/* Upload Time */ { "sTitle" : $.i18n._("Uploaded") , "mDataProp" : "utime" , "bVisible" : false , "sClass" : "library_upload_time" , "sWidth" : "155px" },
/* Website */ { "sTitle" : $.i18n._("Website") , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" },
/* Year */ { "sTitle" : $.i18n._("Year") , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" },
];
var ajaxSourceURL = baseUrl+"rest/media";
//Set up the div with id "example-table" as a datatable.
var table = AIRTIME.widgets.table.init(
$('#example-table'), //DOM node to create the table inside.
true, //Enable item selection
{ //Datatables overrides.
'aoColumns' : aoColumns,
'sAjaxSource' : ajaxSourceURL
});
});