general: remove cell content only once new content has arrived (#9596)

This commit is contained in:
Frédéric Péters 2016-01-19 14:41:01 +01:00
parent 9909a35461
commit 77c92c7b95
2 changed files with 9 additions and 3 deletions

View File

@ -7,6 +7,7 @@ function combo_load_cell(elem, url) {
success: function(data) {
var parent = $(elem).parent();
$(elem).parent().parent().addClass('ajax-loaded');
$(elem).parent().nextAll().remove();
if (data == '') {
$(elem).remove();
} else {
@ -73,10 +74,9 @@ $(function() {
function combo_refresh_ajax_cells() {
$('[data-ajax-cell-url]').each(function(idx, elem) {
var $elem = $(elem);
var $div = $elem.find('> div');
$div.empty();
var msg = $(elem).data('ajax-cell-loading-message');
$div.append($('<span class="loading-message">' + msg + '</span>'));
$elem.prepend('<div><div class="loading"><span class="loading-message">' + msg + '</span></div></div>');
combo_load_cell($elem.find('div.loading'), $elem.data('ajax-cell-url'));
combo_load_cell($div.find('span'), $elem.data('ajax-cell-url'));
});
}

View File

@ -49,6 +49,12 @@ div.cell div.loading {
to { width: 100%; }
}
div.ajax-loaded div.loading {
position: absolute;
width: 10%;
right: 0;
}
div.cell div.loading span {
position: relative;
z-index: 10;