mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-10 05:39:35 +01:00
Reloading table row with ajax after adding artist
This commit is contained in:
@@ -71,15 +71,21 @@
|
||||
<%def name="javascriptIncludes()">
|
||||
<script src="js/libs/jquery.dataTables.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
function getArtistArt() {
|
||||
$("table#artist_table tr td#name").each(function(){
|
||||
var id = $(this).children('a').attr('title');
|
||||
var artist = $(this).children('a').text();
|
||||
var image = $(this).parent().find("td#albumart img");
|
||||
getArtistInfo(artist,image,1,id);
|
||||
if ( !image.hasClass('done') ) {
|
||||
image.addClass('done');
|
||||
getArtistInfo(artist,image,1,id);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
function initThisPage() {
|
||||
getArtistArt();
|
||||
$('#artist_table').dataTable({
|
||||
"bDestroy": true,
|
||||
"aoColumnDefs": [
|
||||
{ 'bSortable': false, 'aTargets': [ 0 ] }
|
||||
],
|
||||
@@ -97,9 +103,14 @@
|
||||
"sPaginationType": "full_numbers"
|
||||
});
|
||||
resetFilters("artist or album");
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
initThisPage();
|
||||
});
|
||||
$(window).load(function(){
|
||||
initFancybox();
|
||||
refreshLoadArtist();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -222,6 +222,29 @@ function refreshTable() {
|
||||
initThisPage();
|
||||
});
|
||||
}
|
||||
function refreshLoadArtist() {
|
||||
if ( $(".gradeL").length > 0 ) {
|
||||
var url = $(location).attr('href');
|
||||
var loadingRow = $("table.display tr.gradeL")
|
||||
loadingRow.each(function(){
|
||||
var row = $(this).index() + 1;
|
||||
var rowLoad = $("table.display tbody tr:nth-child("+row+")");
|
||||
$(rowLoad).load(url + " table.display tbody tr:nth-child("+ row +") td", function() {
|
||||
if ( $(rowLoad).children("#status").text() == 'Active' ) {
|
||||
// Active
|
||||
$(rowLoad).removeClass('gradeL').addClass('gradeZ');
|
||||
initThisPage();
|
||||
} else {
|
||||
// Still loading
|
||||
setTimeout(function(){
|
||||
refreshLoadArtist();
|
||||
},3000);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function refreshTab() {
|
||||
var url = $(location).attr('href');
|
||||
var tabId = $('.ui-tabs-panel:visible').attr("id");
|
||||
|
||||
Reference in New Issue
Block a user