cloudstack 3.0 UI - listView - when clicking fast between different rows, JS error "args.context.xxx is undefined" appears. e.g. "args.context.instances is undefined" appears when clicking fast between different rows in listView in instance page. Because when clicking fast, users might click another row before API response for this current row is back => which causes the JS error. The fix is to overlay the whole listView by loading image (spinning wheel image) until click-handling for this row is done (e.g. API response is back).

This commit is contained in:
Jessica Wang 2012-03-09 16:47:02 -08:00
parent ae1858d1cd
commit 008fcb8a27
1 changed files with 11 additions and 3 deletions

View File

@ -1312,6 +1312,9 @@
// Click on first item will trigger detail view (if present)
if (detailViewPresent && !uiCustom && !$target.closest('.empty, .loading').size()) {
var $loading = $('<div>').addClass('loading-overlay');
$target.closest('div.data-table').prepend($loading); //overlay the whole listView, so users can't click another row until click-handling for this row is done (e.g. API response is back)
listViewData.detailView.$browser = args.$browser;
detailViewArgs = {
$panel: $target.closest('div.panel'),
@ -1347,9 +1350,14 @@
});
}
createDetailView(detailViewArgs, function($detailView) {
$detailView.data('list-view', $listView);
}, $target.closest('tr'));
createDetailView(
detailViewArgs,
function($detailView) { //complete(), callback funcion
$detailView.data('list-view', $listView);
$loading.remove();
},
$target.closest('tr')
);
return false;
}