1. Smoother transition for loading screen.

2. Fix for IE not reacting to change events.
This commit is contained in:
cdtank 2011-02-11 23:35:53 +00:00
parent 55e86daf91
commit 8ba4e02968
3 changed files with 98 additions and 100 deletions

View file

@ -18,19 +18,12 @@ $(document).ready(function() {
//temporalGraphProcessor.initiateTemporalGraphRenderProcess(graphContainer, jsonString); //temporalGraphProcessor.initiateTemporalGraphRenderProcess(graphContainer, jsonString);
});
//click event handler for clear button
$("a.clear-selected-entities").live('click', function(){
clearRenderedObjects();
});
/* /*
* When the intra-entity parameters are clicked, * When the intra-entity parameters are clicked,
* update the status accordingly. * update the status accordingly.
*/ */
$("select.comparisonValues").live('change', function(){ $("select.comparisonValues").change(function(){
var selectedValue = $("select.comparisonValues option:selected").val(); var selectedValue = $("select.comparisonValues option:selected").val();
@ -64,6 +57,13 @@ $("select.comparisonValues").live('change', function(){
}); });
});
//click event handler for clear button
$("a.clear-selected-entities").live('click', function(){
clearRenderedObjects();
});
$("input[type=checkbox].easyDeselectCheckbox").live('click', function(){ $("input[type=checkbox].easyDeselectCheckbox").live('click', function(){
var checkbox = $(this); var checkbox = $(this);
@ -189,9 +189,57 @@ function entityCheckboxOperatedOnEventListener() {
} }
function getTemporalGraphDataFromServer() { /*
* This method will setup the options for loading screen & then activate the
* loading screen.
* */
function setupLoadingScreen(visContainerDIV) {
$.blockUI.defaults.overlayCSS = {
backgroundColor: '#fff',
opacity: 1.0
};
$.blockUI.defaults.css.width = '500px';
$.blockUI.defaults.css.border = '0px';
$.blockUI.defaults.css.top = '15%';
visContainerDIV.block({
message: '<h3><img src="' + loadingImageLink
+ '" />&nbsp;Loading data for <i>'
+ organizationLabel
+ '</i></h3>'
});
}
/*
* This function gets json data for temporal graph & after rendering removes the
* loading message. It will also display the error container in case of any error.
* */
function getTemporalGraphData(temporalGraphDataURL,
graphBodyDIV,
errorBodyDIV,
visContainerDIV) {
$.ajax({
url: temporalGraphDataURL,
dataType: "json",
success: function (data) {
if (data.error) {
graphBodyDIV.remove();
errorBodyDIV.show();
visContainerDIV.unblock();
} else {
graphBodyDIV.show();
errorBodyDIV.remove();
temporalGraphProcessor.initiateTemporalGraphRenderProcess(graphContainer, data);
visContainerDIV.unblock();
}
}
});
} }

View file

@ -21,37 +21,12 @@ var subOrganizationTemporalGraphURL = "${subOrganizationGrantTemporalGraphCommon
$(document).ready(function () { $(document).ready(function () {
$.blockUI.defaults.overlayCSS = { setupLoadingScreen($("div#temporal-graph-response"));
backgroundColor: '#fff',
opacity: 1.0
};
$.blockUI.defaults.css.width = '500px'; getTemporalGraphData('${temporalGraphDataURL}',
$.blockUI.defaults.css.border = '0px'; $("#body"),
$.blockUI.defaults.css.top = '15%'; $("#error-container"),
$("div#temporal-graph-response"));
$("div#temporal-graph-response").block({
message: '<h3><img src="' + loadingImageLink + '" />&nbsp;Loading data for <i>${organizationLabel}</i></h3>'
});
$.ajax({
url: '${temporalGraphDataURL}',
dataType: "json",
success: function (data) {
if (data.error) {
$("#body").remove();
$("#error-container").show();
$("div#temporal-graph-response").unblock();
} else {
$("#body").show();
$("#error-container").remove();
temporalGraphProcessor.initiateTemporalGraphRenderProcess(graphContainer, data);
$("div#temporal-graph-response").unblock();
}
}
});
}); });

View file

@ -21,37 +21,12 @@ var subOrganizationTemporalGraphURL = "${subOrganizationPublicationTemporalGraph
$(document).ready(function () { $(document).ready(function () {
$.blockUI.defaults.overlayCSS = { setupLoadingScreen($("div#temporal-graph-response"));
backgroundColor: '#fff',
opacity: 1.0
};
$.blockUI.defaults.css.width = '500px'; getTemporalGraphData('${temporalGraphDataURL}',
$.blockUI.defaults.css.border = '0px'; $("#body"),
$.blockUI.defaults.css.top = '15%'; $("#error-container"),
$("div#temporal-graph-response"));
$("div#temporal-graph-response").block({
message: '<h3><img src="' + loadingImageLink + '" />&nbsp;Loading data for <i>${organizationLabel}</i></h3>'
});
$.ajax({
url: '${temporalGraphDataURL}',
dataType: "json",
success: function (data) {
if (data.error) {
$("#body").remove();
$("#error-container").show();
$("div#temporal-graph-response").unblock();
} else {
$("#body").show();
$("#error-container").remove();
temporalGraphProcessor.initiateTemporalGraphRenderProcess(graphContainer, data);
$("div#temporal-graph-response").unblock();
}
}
});
}); });