From 59e3150fc351ab64f6d7dd66697c33c57dbb451f Mon Sep 17 00:00:00 2001 From: ryounes Date: Wed, 29 Jun 2011 13:45:21 +0000 Subject: [PATCH] NIHVIVO-2787 Fix js to handle unexpected empty individual set returned from controller --- webapp/web/js/menupage/browseByVClass.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/webapp/web/js/menupage/browseByVClass.js b/webapp/web/js/menupage/browseByVClass.js index 2ad26cfe2..794484c2d 100644 --- a/webapp/web/js/menupage/browseByVClass.js +++ b/webapp/web/js/menupage/browseByVClass.js @@ -26,7 +26,7 @@ var browseByVClass = { }, // Event listeners. Called on page load - bindEventListeners: function() { + bindEventListeners: function() { // Listeners for vClass switching this.vgraphVClassLinks.click(function() { uri = $(this).attr('data-uri'); @@ -215,6 +215,8 @@ var browseByVClass = { // Add active class for requested alpha $('#alpha-browse-individuals li a[data-alpha="'+ alpha +'"]').addClass('selected'); + + return alpha; }, // Wipe the currently displayed individuals, no-content message, and existing pagination @@ -226,16 +228,20 @@ var browseByVClass = { // When no individuals are returned for the AJAX request, print a reasonable message for the user emptyResultSet: function(vclass, alpha) { + var nothingToSeeHere; + this.wipeSlate(); - this.selectedAlpha(alpha); + alpha = this.selectedAlpha(alpha); if ( alpha != "all" ) { nothingToSeeHere = '

There are no '+ vclass.name +' individuals whose name starts with '+ alpha.toUpperCase() +'.

Please try another letter or browse all.

'; } else { nothingToSeeHere = '

There are no '+ vclass.name +' individuals in the system.

Please select another class from the list.

'; } - browseByVClass.individualsContainer.prepend(nothingToSeeHere); + + browseByVClass.individualsContainer.prepend(nothingToSeeHere); } + }; $(document).ready(function() {