Project

General

Profile

« Previous | Next » 

Revision 5688

check for exact class match when typing into search term - if there is one, then select it as the chosen term

View differences:

index.jsp
124 124
			// enable searching on it
125 125
			$("#" + divId + "Search").keyup(
126 126
				function () {
127
					if ($("#" + divId + "Search").val().length >= 3) {
127
					var searchTerm = $("#" + divId + "Search").val();
128
					if (searchTerm.length >= 3) {
128 129
						// search
129
						$("#" + divId).jstree("search", $("#" + divId + "Search").val());
130
						$("#" + divId).jstree("search", searchTerm);
130 131
						// now prune
131 132
						prune(divId, "jstree-search");
133
						// is it an exact match?
134
						checkExactMatch(divId, searchTerm, "jstree-search");
132 135
					}
133 136
				});
134 137
			
......
194 197
			$(this).hide();
195 198
		});
196 199
}
200
function checkExactMatch(divId, searchTerm, matchClass) {
201
	// get the current search matches
202
	var matches = $("#" + divId).find("a." + matchClass);
203
	// get their parent nodes
204
	matches = $(matches).parents("li");
205
	// check for exact matches
206
	var exactMatch = $(matches).filter("#" + searchTerm).first();
207
	if (exactMatch && exactMatch.length == 1) {
208
		//alert("exactMatch: " + exactMatch);
209
		select($(exactMatch).children("a"));
210
	}
211
}
197 212
function doActiveDomain(divId) {
198 213
	if ($("#" + divId + "Only").is(":checked")) {
199 214
		// prune to active

Also available in: Unified diff