Merge branch 'cc-2211-changes-to-playlist-not-shown' into devel

This commit is contained in:
martin 2011-04-29 15:31:18 -04:00
commit 50c649dc59
8 changed files with 76 additions and 1 deletions

View file

@ -97,6 +97,9 @@ function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
}
$(nRow).attr("id", type+'_'+id);
// insert id on lenth field
$('td:eq(4)', nRow).attr("id", "length");
$('td:eq(5) img', nRow).qtip({

View file

@ -258,6 +258,10 @@ function setSPLContent(json) {
$(".spl_fade_control").click(openFadeEditor);
//$(".spl_playlength").click(openCueEditor);
$(".spl_cue").click(openCueEditor);
//redraw the library list
dt = $("#library_display").dataTable();
dt.fnStandingRedraw();
return false;
}
@ -359,7 +363,11 @@ function createPlaylistMetaForm(json) {
$.post(url, data, function(json){
openDiffSPL(json);
//redraw the library list
dt = $("#library_display").dataTable();
dt.fnStandingRedraw();
})
});
$("#side_playlist")
@ -381,6 +389,10 @@ function deleteSPL() {
url = '/Playlist/delete-active/format/json';
$.post(url, noOpenPL);
//redraw the library list
dt = $("#library_display").dataTable();
dt.fnStandingRedraw();
}
function openDiffSPL(json) {

View file

@ -0,0 +1,55 @@
$.fn.dataTableExt.oApi.fnStandingRedraw = function(oSettings) {
//redraw to account for filtering and sorting
// concept here is that (for client side) there is a row got inserted at the end (for an add)
// or when a record was modified it could be in the middle of the table
// that is probably not supposed to be there - due to filtering / sorting
// so we need to re process filtering and sorting
// BUT - if it is server side - then this should be handled by the server - so skip this step
if(oSettings.oFeatures.bServerSide === false){
var before = oSettings._iDisplayStart;
oSettings.oApi._fnReDraw(oSettings);
//iDisplayStart has been reset to zero - so lets change it back
oSettings._iDisplayStart = before;
oSettings.oApi._fnCalculateEnd(oSettings);
}
//draw the 'current' page
oSettings.oApi._fnDraw(oSettings);
};
$.fn.dataTableExt.oApi.fnAddDataAndDisplay = function ( oSettings, aData )
{
/* Add the data */
var iAdded = this.oApi._fnAddData( oSettings, aData );
var nAdded = oSettings.aoData[ iAdded ].nTr;
/* Need to re-filter and re-sort the table to get positioning correct, not perfect
* as this will actually redraw the table on screen, but the update should be so fast (and
* possibly not alter what is already on display) that the user will not notice
*/
this.oApi._fnReDraw( oSettings );
/* Find it's position in the table */
var iPos = -1;
for( var i=0, iLen=oSettings.aiDisplay.length ; i<iLen ; i++ )
{
if( oSettings.aoData[ oSettings.aiDisplay[i] ].nTr == nAdded )
{
iPos = i;
break;
}
}
/* Get starting point, taking account of paging */
if( iPos >= 0 )
{
oSettings._iDisplayStart = ( Math.floor(i / oSettings._iDisplayLength) ) * oSettings._iDisplayLength;
this.oApi._fnCalculateEnd( oSettings );
}
this.oApi._fnDraw( oSettings );
return {
"nTr": nAdded,
"iPos": iAdded
};
}