1. Fixed the bug in temporal graph vis, where more than 10 entities could be selected.
2. fixed the notification to show a proper error message & for decent amount of time. 3. Did major reactors to javascript code to make it go faster.
This commit is contained in:
parent
eab9b4ef8d
commit
58336a27de
2 changed files with 57 additions and 56 deletions
|
@ -664,8 +664,8 @@ function updateCounter(){
|
||||||
//notification about the max items that can be clicked
|
//notification about the max items that can be clicked
|
||||||
$("#counter").text(renderedObjects.length);
|
$("#counter").text(renderedObjects.length);
|
||||||
if (freeColors.length == 0) {
|
if (freeColors.length == 0) {
|
||||||
$.jGrowl("Colors left: " + freeColors.length, {
|
$.jGrowl("You can not select more than 10 entities at one time.", {
|
||||||
life: 50
|
life: 3000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -769,13 +769,32 @@ function prepareTableForDataTablePagination(jsonData){
|
||||||
|
|
||||||
var entityListTable = $('#datatable').dataTable({
|
var entityListTable = $('#datatable').dataTable({
|
||||||
"sDom": '<"' + searchBarParentContainerDIVClass + '"f><"paginatedtabs"p><"datatablewrapper"t>',
|
"sDom": '<"' + searchBarParentContainerDIVClass + '"f><"paginatedtabs"p><"datatablewrapper"t>',
|
||||||
"aaSorting" : [[2, "desc"]],
|
"aaSorting": [
|
||||||
|
[2, "desc"]
|
||||||
|
],
|
||||||
|
"asStripClasses": [],
|
||||||
"iDisplayLength": 10,
|
"iDisplayLength": 10,
|
||||||
"sPaginationType": "full_numbers",
|
"sPaginationType": "full_numbers",
|
||||||
// "aLengthMenu" : [5,10,15],
|
// "aLengthMenu" : [5,10,15],
|
||||||
"fnDrawCallback": function () {
|
"fnDrawCallback": function () {
|
||||||
$('tr>td:nth-child(1)>input').bind('click', function () { $(this).parent().parent().children().each(function(){$(this).addClass('datatablerowhighlight');}); });
|
|
||||||
$('tr>td:nth-child(1)>input').bind('click', function () { if(!$(this).is(':checked')) { $(this).parent().parent().children().each(function(){$(this).removeClass('datatablerowhighlight');});} });
|
/*
|
||||||
|
* To highlight the rows belonging to selected entities.
|
||||||
|
* */
|
||||||
|
$('input.if_clicked_on_school').bind('click', function () {
|
||||||
|
if ($(this).is(':checked')) {
|
||||||
|
$(this).closest("tr").addClass('datatablerowhighlight')
|
||||||
|
} else {
|
||||||
|
$(this).closest("tr").removeClass('datatablerowhighlight')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/* We check whether max number of allowed comparisions (currently 10) is reached
|
||||||
|
* here as well becasue the only function that is guaranteed to be called during
|
||||||
|
* page navigation is this. No need to bind it to the nav-buttons becuase 1. It is over-ridden
|
||||||
|
* by built-in navigation events & this is much cleaner.
|
||||||
|
* */
|
||||||
|
checkIfColorLimitIsReached();
|
||||||
}
|
}
|
||||||
|
|
||||||
// "bLengthChange": false,
|
// "bLengthChange": false,
|
||||||
|
@ -790,31 +809,10 @@ function prepareTableForDataTablePagination(jsonData){
|
||||||
entityListTable.fnFilter("");
|
entityListTable.fnFilter("");
|
||||||
});
|
});
|
||||||
|
|
||||||
bindPaginatedTabsToEvents();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindPaginatedTabsToEvents(){
|
|
||||||
|
|
||||||
$('#datatable_paginate>span').bind('click', function(){
|
|
||||||
//console.log($(this));
|
|
||||||
checkIfColorLimitIsReached();
|
|
||||||
// bindInnerPaginatedTabsToEvents();
|
|
||||||
// $.each($('#datatable_paginate>span>span'), function(index, val){
|
|
||||||
// console.log('child: ', $(this));
|
|
||||||
// });
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//function bindInnerPaginatedTabsToEvents(){
|
|
||||||
// $('#datatable_paginate>span>span').live('click', function(){
|
|
||||||
// console.log($(this), 'is clicked');
|
|
||||||
// });
|
|
||||||
//}
|
|
||||||
|
|
||||||
function updateRowHighlighter(linkedCheckBox){
|
function updateRowHighlighter(linkedCheckBox){
|
||||||
linkedCheckBox.parent().parent().children().each(function(){$(this).removeClass('datatablerowhighlight');});
|
linkedCheckBox.closest("tr").removeClass('datatablerowhighlight');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -875,35 +873,31 @@ function getSize(map){
|
||||||
}
|
}
|
||||||
|
|
||||||
function disableUncheckedEntities(){
|
function disableUncheckedEntities(){
|
||||||
//console.log('Inside disableUncheckedEntities');
|
|
||||||
|
|
||||||
var unCheckedBoxes = $("input[type=checkbox].if_clicked_on_school").filter(function(){
|
$.each($("input[type=checkbox].if_clicked_on_school:not(:checked)"), function(index, val){
|
||||||
if(!$(this).is(':checked')){
|
|
||||||
//console.log($(this).attr("value"));
|
|
||||||
return $(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$.each(unCheckedBoxes, function(index, val){
|
|
||||||
$(val).attr('disabled', true);
|
$(val).attr('disabled', true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//console.log($("input[type=checkbox].if_clicked_on_school:not(:checked)"));
|
||||||
|
|
||||||
|
$("#datatable").data("isEntitySelectionAllowed", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableUncheckedEntities(){
|
function enableUncheckedEntities(){
|
||||||
var disabledCheckedBoxes = $("input[type=checkbox].if_clicked_on_school").filter(function(){
|
|
||||||
if($(this).attr('disabled', true)){
|
|
||||||
//console.log($(this).attr("value"));
|
|
||||||
return $(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$.each(disabledCheckedBoxes, function(index, val){
|
$.each($("input[type=checkbox].if_clicked_on_school:not(:checked)"), function(index, val){
|
||||||
$(val).attr('disabled', false);
|
$(val).attr('disabled', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$("#datatable").data("isEntitySelectionAllowed", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkIfColorLimitIsReached(){
|
function checkIfColorLimitIsReached(){
|
||||||
|
|
||||||
|
// console.log(getSize(labelToCheckedEntities));
|
||||||
|
|
||||||
if(getSize(labelToCheckedEntities) >= 10){
|
if(getSize(labelToCheckedEntities) >= 10){
|
||||||
disableUncheckedEntities();
|
disableUncheckedEntities();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -29,7 +29,9 @@
|
||||||
|
|
||||||
<script type="text/javascript" src="${flot}"></script>
|
<script type="text/javascript" src="${flot}"></script>
|
||||||
<script type="text/javascript" src="${fliptext}"></script>
|
<script type="text/javascript" src="${fliptext}"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="${jgrowl}"></script>
|
<script type="text/javascript" src="${jgrowl}"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="${datatable}"></script>
|
<script type="text/javascript" src="${datatable}"></script>
|
||||||
<script type="text/javascript" src="${autoellipsis}"></script>
|
<script type="text/javascript" src="${autoellipsis}"></script>
|
||||||
<script type="text/javascript" src="${entityComparisonUtils}"></script>
|
<script type="text/javascript" src="${entityComparisonUtils}"></script>
|
||||||
|
@ -66,6 +68,11 @@ var temporalGraphSmallIcon = "${temporalGraphSmallIcon}";
|
||||||
var jsonString = '${jsonContent}';
|
var jsonString = '${jsonContent}';
|
||||||
var organizationLabel = '${organizationLabel}';
|
var organizationLabel = '${organizationLabel}';
|
||||||
|
|
||||||
|
/* This is used to cache the current state whether the user is allowed to select more entities from
|
||||||
|
the datatable or not. Once Max number of entity selection is reached the user can no longer select
|
||||||
|
more & this variable will be set to false. */
|
||||||
|
$("#datatable").data("isEntitySelectionAllowed", true);
|
||||||
|
|
||||||
$("#organizationLabel").text(organizationLabel).css("color", "#2485ae");
|
$("#organizationLabel").text(organizationLabel).css("color", "#2485ae");
|
||||||
$("#organizationMoniker").text(organizationLabel);
|
$("#organizationMoniker").text(organizationLabel);
|
||||||
$("#organizationMoniker").attr("href", "${organizationVivoProfileURL}");
|
$("#organizationMoniker").attr("href", "${organizationVivoProfileURL}");
|
||||||
|
|
Loading…
Add table
Reference in a new issue