thaddeusmt avatar thaddeusmt committed 8919096

added no results found to search

Comments (0)

Files changed (1)

     });
 
 	$('#profile').live('pageshow',function(event, ui){
-		console.log("profile page show");
+		//console.log("profile page show");
     });
 
     $('#searchpage').live('pageshow',function(event, ui){
 		});
 
 	    drawListing(0,10,null);
+		//checkIfEmpty();
 		
 		
         /*$('#query').bind('change', function(e){
 		$.mobile.showPageLoadingMsg();
 		searchTerm = $('#query')[0].value;
 		drawListing(0,10,searchTerm);
+		//checkIfEmpty();
     });
 	
 	$('.ui-input-clear').live('click', function(e){
 		$.mobile.showPageLoadingMsg();
 		drawListing(0,10,'');
 	});
+	
+	function checkIfEmpty() {
+		console.log("empty?" + $("#search_results").children().length);
+		/*if($("#search_results li").size()) == 0) {
+			$("#search_results").append("No results found.");
+		}*/
+	}
 
 	function queryBind() {
 		$('#search_results').empty();
 
 	function drawListing(current, showNext, searchTerm) {
 		bugFilter = $('#bugfilter')[0].value;
-		console.log(bugFilter);
+		//console.log(bugFilter);
 		amplify.request( "jsonData", function( data ) {
 			for (i=current; i<data.length; i++) {
 				if (data[i]) {
 					if (showNext) {
-						console.log(data[i].properties.rating);
+						//console.log(data[i].properties.rating);
 						if (!searchTerm && !bugFilter) {
 							doListings(data[i]);
 							showNext--;
 							doListings(data[i]);
 							showNext--;
 						} else if (data[i].properties.name.search(new RegExp(searchTerm,"i")) != -1 && data[i].properties.rating == bugFilter) {
-						
+							doListings(data[i]);
+							showNext--;
 						}
 					} else {
 						$('#search_results').listview('refresh');
 						$.mobile.hidePageLoadingMsg();
+						console.log("empty?" + $("#search_results li").length);
 						return i;
 					}
 				}
 			}
+			console.log($('#search_results li').length);
+			if ($('#search_results li').length == 0) {
+				$('#search_results').append("<li>No results found.</li>");
+			}
 			$('#search_results').listview('refresh');
 			$.mobile.hidePageLoadingMsg();
 		});
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.