1. Did minor refactor in preparation for saving the state & possibly just swapping daata instead of redirecting to a completely new page when the change in parameter happens on the temporal graph vis.
This commit is contained in:
parent
8b9d3cb4b7
commit
f69e2eb904
3 changed files with 48 additions and 40 deletions
|
@ -13,19 +13,9 @@ $(document).ready(function() {
|
||||||
|
|
||||||
$notificationContainer = $("#notification-container").notify();
|
$notificationContainer = $("#notification-container").notify();
|
||||||
|
|
||||||
var jsonObject = {
|
|
||||||
prepare : function(arg1){
|
|
||||||
loadData(arg1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
graphContainer = $("#graphContainer");
|
graphContainer = $("#graphContainer");
|
||||||
tableDiv = $('#paginatedTable');
|
tableDiv = $('#paginatedTable');
|
||||||
|
|
||||||
// initial display of the grid when the page loads
|
|
||||||
init(graphContainer);
|
|
||||||
|
|
||||||
|
|
||||||
//click event handler for clear button
|
//click event handler for clear button
|
||||||
$("a.clear-selected-entities").click(function(){
|
$("a.clear-selected-entities").click(function(){
|
||||||
clearRenderedObjects();
|
clearRenderedObjects();
|
||||||
|
@ -90,9 +80,6 @@ $(document).ready(function() {
|
||||||
updateCounter();
|
updateCounter();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//parse the json object and pass it to loadData
|
|
||||||
jsonObject.prepare(jQuery.parseJSON(jsonString));
|
|
||||||
|
|
||||||
function performEntityCheckboxUnselectedActions(entity, checkboxValue, checkbox) {
|
function performEntityCheckboxUnselectedActions(entity, checkboxValue, checkbox) {
|
||||||
|
|
||||||
|
@ -114,6 +101,9 @@ $(document).ready(function() {
|
||||||
|
|
||||||
renderLineGraph(renderedObjects, entity);
|
renderLineGraph(renderedObjects, entity);
|
||||||
labelToCheckedEntities[checkboxValue] = checkbox;
|
labelToCheckedEntities[checkboxValue] = checkbox;
|
||||||
|
labelToCheckedEntities[checkboxValue].entity = entity;
|
||||||
|
|
||||||
|
// console.log(labelToCheckedEntities[checkboxValue], entity);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To highlight the rows belonging to selected entities.
|
* To highlight the rows belonging to selected entities.
|
||||||
|
@ -164,11 +154,11 @@ $(document).ready(function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When the elements in the paginated div
|
* When the elements in the paginated div
|
||||||
* are clicked this event handler is called
|
* are clicked this event handler is called
|
||||||
*/
|
*/
|
||||||
$("input.if_clicked_on_school").live('click', function () {
|
$("input." + entityCheckboxSelectorDOMClass).live('click', function () {
|
||||||
|
|
||||||
var checkbox = $(this);
|
var checkbox = $(this);
|
||||||
var checkboxValue = $(this).attr("value");
|
var checkboxValue = $(this).attr("value");
|
||||||
|
@ -188,26 +178,40 @@ $(document).ready(function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
This will make sure that top 3 entites are selected by default when the page loads.
|
|
||||||
|
|
||||||
*/
|
function initiateTemporalGraphRenderProcess(givenGraphContainer, jsonData) {
|
||||||
$.each($("input.if_clicked_on_school"), function(index, checkbox) {
|
|
||||||
|
/*
|
||||||
if (index > 2) {
|
* initial display of the grid when the page loads
|
||||||
return false;
|
* */
|
||||||
}
|
init(givenGraphContainer);
|
||||||
|
|
||||||
$(this).attr('checked', true);
|
/*
|
||||||
|
* render the temporal graph per the sent content.
|
||||||
|
* */
|
||||||
|
loadData(jQuery.parseJSON(jsonData));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This will make sure that top 3 entities are selected by default when the page loads.
|
||||||
|
*/
|
||||||
|
$.each($("input." + entityCheckboxSelectorDOMClass), function(index, checkbox) {
|
||||||
|
|
||||||
var checkboxValue = $(this).attr("value");
|
if (index > 2) {
|
||||||
var entity = labelToEntityRecord[checkboxValue];
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
performEntityCheckboxSelectedActions(entity, checkboxValue, $(this));
|
$(this).attr('checked', true);
|
||||||
|
|
||||||
performEntityCheckboxClickedRedrawActions();
|
var checkboxValue = $(this).attr("value");
|
||||||
|
var entity = labelToEntityRecord[checkboxValue];
|
||||||
});
|
|
||||||
|
performEntityCheckboxSelectedActions(entity, checkboxValue, $(this));
|
||||||
|
|
||||||
|
performEntityCheckboxClickedRedrawActions();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
initiateTemporalGraphRenderProcess(graphContainer, jsonString);
|
||||||
});
|
});
|
|
@ -862,7 +862,7 @@ function generateCheckBoxes(label, checkedFlag, fontFlag){
|
||||||
|
|
||||||
var checkbox = $('<input>');
|
var checkbox = $('<input>');
|
||||||
checkbox.attr('type','checkbox');
|
checkbox.attr('type','checkbox');
|
||||||
checkbox.attr('class','if_clicked_on_school');
|
checkbox.attr('class', entityCheckboxSelectorDOMClass);
|
||||||
checkbox.attr('value', label);
|
checkbox.attr('value', label);
|
||||||
if(checkedFlag == 1){
|
if(checkedFlag == 1){
|
||||||
checkbox.attr('checked');
|
checkbox.attr('checked');
|
||||||
|
@ -988,7 +988,7 @@ function prepareTableForDataTablePagination(jsonData){
|
||||||
var row = $('<tr>');
|
var row = $('<tr>');
|
||||||
|
|
||||||
var checkboxTD = $('<td>');
|
var checkboxTD = $('<td>');
|
||||||
checkboxTD.html('<div class="disabled-checkbox-event-receiver"> </div><input type="checkbox" class="if_clicked_on_school" value="' + index + '"'+'/>');
|
checkboxTD.html('<div class="disabled-checkbox-event-receiver"> </div><input type="checkbox" class="' + entityCheckboxSelectorDOMClass + '" value="' + index + '"'+'/>');
|
||||||
|
|
||||||
var labelTD = $('<td>');
|
var labelTD = $('<td>');
|
||||||
labelTD.css("width", "100px");
|
labelTD.css("width", "100px");
|
||||||
|
@ -1118,7 +1118,7 @@ function getSize(map){
|
||||||
|
|
||||||
function disableUncheckedEntities(){
|
function disableUncheckedEntities(){
|
||||||
|
|
||||||
$.each($("input[type=checkbox].if_clicked_on_school:not(:checked)"), function(index, val){
|
$.each($("input[type=checkbox]." + entityCheckboxSelectorDOMClass + ":not(:checked)"), function(index, val){
|
||||||
$(val).attr('disabled', true);
|
$(val).attr('disabled', true);
|
||||||
$(val).prev().show();
|
$(val).prev().show();
|
||||||
});
|
});
|
||||||
|
@ -1147,7 +1147,7 @@ function disableUncheckedEntities(){
|
||||||
|
|
||||||
function enableUncheckedEntities(){
|
function enableUncheckedEntities(){
|
||||||
|
|
||||||
$.each($("input[type=checkbox].if_clicked_on_school:not(:checked)"), function(index, val){
|
$.each($("input[type=checkbox]." + entityCheckboxSelectorDOMClass + ":not(:checked)"), function(index, val){
|
||||||
$(val).attr('disabled', false);
|
$(val).attr('disabled', false);
|
||||||
$(val).prev().hide();
|
$(val).prev().hide();
|
||||||
});
|
});
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
"value": "Grants" }>
|
"value": "Grants" }>
|
||||||
|
|
||||||
<#assign parameterOptions = [publicationParameter, grantParameter]>
|
<#assign parameterOptions = [publicationParameter, grantParameter]>
|
||||||
|
|
||||||
|
<#assign entityCheckboxSelectorDOMClass = "entity-selector-checkbox">
|
||||||
|
|
||||||
<#-- Javascript files -->
|
<#-- Javascript files -->
|
||||||
|
|
||||||
|
@ -84,6 +86,8 @@ var organizationVIVOProfileURL = "${organizationVivoProfileURL}";
|
||||||
|
|
||||||
var loadingImageLink = contextPath + "/images/visualization/ajax-loader.gif";
|
var loadingImageLink = contextPath + "/images/visualization/ajax-loader.gif";
|
||||||
|
|
||||||
|
var entityCheckboxSelectorDOMClass = "${entityCheckboxSelectorDOMClass}";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This has to be declared before making a call to GUI event manager JS.
|
This has to be declared before making a call to GUI event manager JS.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue