-small fixes to now playing
This commit is contained in:
parent
7093ebd23f
commit
b9e1078e10
|
@ -1,4 +1,5 @@
|
||||||
<div class="button-bar-top">
|
<div class="button-bar-top">
|
||||||
<a href="javascript:void(0)" class="toggle-button-active end-button" id="now_view">Now View</a><a href="javascript:void(0)" class="toggle-button" id="day_view">Day View</a>
|
<a href="javascript:void(0)" class="toggle-button-active end-button" id="now_view">Now View</a><a href="javascript:void(0)" class="toggle-button" id="day_view">Day View</a>
|
||||||
</div>
|
</div>
|
||||||
<div id='demo'></div>
|
<table cellpadding="0" cellspacing="0" border="0" class="datatable" id="nowplayingtable"></table>
|
||||||
|
<!--<div id='demo'></div>-->
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
var registered = false;
|
var registered = false;
|
||||||
var datagridData;
|
var datagridData = null;
|
||||||
|
|
||||||
function getDateText(obj){
|
function getDateText(obj){
|
||||||
var str = obj.aData[ obj.iDataColumn ].toString();
|
var str = obj.aData[ obj.iDataColumn ].toString();
|
||||||
|
@ -42,52 +42,21 @@ function notifySongEnd(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
createDataGrid();
|
updateDataTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
var columns = [{"sTitle": "type", "bVisible":false},
|
var columns = [{"sTitle": "type", "bVisible":false},
|
||||||
{"sTitle":"Date"},
|
{"sTitle":"Date"},
|
||||||
{"sTitle":"Start"},
|
{"sTitle":"Start"},
|
||||||
{"sTitle":"End"},
|
{"sTitle":"End"},
|
||||||
{"sTitle":"Duration"},
|
{"sTitle":"Duration"},
|
||||||
{"sTitle":"Song"},
|
{"sTitle":"Song"},
|
||||||
{"sTitle":"Artist"},
|
{"sTitle":"Artist"},
|
||||||
{"sTitle":"Album"},
|
{"sTitle":"Album"},
|
||||||
{"sTitle":"Playlist"},
|
{"sTitle":"Playlist"},
|
||||||
{"sTitle":"Show"},
|
{"sTitle":"Show"},
|
||||||
{"sTitle":"bgcolor", "bVisible":false},
|
{"sTitle":"bgcolor", "bVisible":false},
|
||||||
{"sTitle":"group_id", "bVisible":false}];
|
{"sTitle":"group_id", "bVisible":false}];
|
||||||
|
|
||||||
function createDataGrid(){
|
|
||||||
|
|
||||||
columns[1]["fnRender"] = getDateText;
|
|
||||||
columns[2]["fnRender"] = getTimeText;
|
|
||||||
columns[3]["fnRender"] = getTimeText;
|
|
||||||
columns[4]["fnRender"] = changeTimePrecisionInit;
|
|
||||||
|
|
||||||
$('#demo').html( '<table cellpadding="0" cellspacing="0" border="0" class="datatable" id="nowplayingtable"></table>' );
|
|
||||||
$('#nowplayingtable').dataTable( {
|
|
||||||
"bSort" : false,
|
|
||||||
"bJQueryUI": true,
|
|
||||||
"bFilter": false,
|
|
||||||
"bInfo": false,
|
|
||||||
"bLengthChange": false,
|
|
||||||
"bPaginate": false,
|
|
||||||
"aoColumns": columns,
|
|
||||||
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
|
||||||
if (aData[aData.length-2] == "t")
|
|
||||||
$(nRow).attr("class", "playing-list");
|
|
||||||
if (aData[0] == "c")
|
|
||||||
$(nRow).attr("class", "playing-song");
|
|
||||||
else if (aData[0] == "b")
|
|
||||||
$(nRow).attr("class", "gap");
|
|
||||||
return nRow;
|
|
||||||
},
|
|
||||||
"bAutoWidth":false
|
|
||||||
} );
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDateString(){
|
function getDateString(){
|
||||||
var date0 = $("#datepicker").datepicker("getDate");
|
var date0 = $("#datepicker").datepicker("getDate");
|
||||||
|
@ -106,11 +75,14 @@ function getAJAXURL(){
|
||||||
|
|
||||||
function updateDataTable(){
|
function updateDataTable(){
|
||||||
var table = $('#nowplayingtable').dataTable();
|
var table = $('#nowplayingtable').dataTable();
|
||||||
|
|
||||||
table.fnClearTable(false);
|
//Check if datagridData has been initialized since this update
|
||||||
table.fnAddData(datagridData.rows, false);
|
//function can be called before ajax call has been returned.
|
||||||
table.fnDraw(true);
|
if (datagridData != null){
|
||||||
|
table.fnClearTable(false);
|
||||||
|
table.fnAddData(datagridData.rows, false);
|
||||||
|
table.fnDraw(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getData(){
|
function getData(){
|
||||||
|
@ -136,6 +108,34 @@ function redirect(url){
|
||||||
document.location.href = url;
|
document.location.href = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createDataGrid(){
|
||||||
|
|
||||||
|
columns[1]["fnRender"] = getDateText;
|
||||||
|
columns[2]["fnRender"] = getTimeText;
|
||||||
|
columns[3]["fnRender"] = getTimeText;
|
||||||
|
columns[4]["fnRender"] = changeTimePrecisionInit;
|
||||||
|
|
||||||
|
$('#nowplayingtable').dataTable( {
|
||||||
|
"bSort" : false,
|
||||||
|
"bJQueryUI": true,
|
||||||
|
"bFilter": false,
|
||||||
|
"bInfo": false,
|
||||||
|
"bLengthChange": false,
|
||||||
|
"bPaginate": false,
|
||||||
|
"aoColumns": columns,
|
||||||
|
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||||
|
if (aData[aData.length-2] == "t")
|
||||||
|
$(nRow).attr("class", "playing-list");
|
||||||
|
if (aData[0] == "c")
|
||||||
|
$(nRow).attr("class", "playing-song");
|
||||||
|
else if (aData[0] == "b")
|
||||||
|
$(nRow).attr("class", "gap");
|
||||||
|
return nRow;
|
||||||
|
},
|
||||||
|
"bAutoWidth":false
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
createDataGrid();
|
createDataGrid();
|
||||||
|
|
Loading…
Reference in New Issue