Project

General

Profile

« Previous | Next » 

Revision 5665

asynchronously load search results after each tree selection event

View differences:

index.jsp
214 214
	var shortName = $(item).parent().attr("id");
215 215
	$("#" + $(treeInstance).attr("id") + "Search").val(shortName)
216 216

  
217
	// refresh the search results
218
	doSearch($("#searchForm").get(0));
219
	
217 220
	// refresh the other trees for active domain after this filtering action
218 221
	// TODO actually do the active domain filtering when selection is made
219 222
	//initialize($(parent).children("div"));
220 223
}
224
function doSearch(formObj) {
225
	// set the hidden parameters based on the current state of the form
226
	checkSearch(formObj);
227
	
228
	//load the results
229
	$("#searchResults").load(
230
		"<%=SERVLET_URL%>" + " #content_wrapper",
231
		$(formObj).serialize(),
232
		// call back function when loading finishes
233
		function(response, status, xhr) {
234
			if (status == "error") {
235
				var msg = "Sorry but there was an error performing the search: ";
236
				$("#error").html(msg + xhr.status + " " + xhr.statusText);
237
			}
238
		});
239
		
240
	return false;
241
	
242
}
221 243
function donothing() {}
222 244
--></script>
223 245

  
......
235 257
	<!-- error messages here -->
236 258
</div>
237 259

  
238
<form method="POST" action="<%=SERVLET_URL%>" target="_top" id="searchForm" name="searchForm" onSubmit="return checkSearch(this)">
260
<form method="POST" 
261
		action="<%=SERVLET_URL%>" 
262
		target="_top" 
263
		id="searchForm" 
264
		name="searchForm" 
265
		onSubmit="return doSearch(this)">
239 266
	<input name="query" type="hidden" />
240 267
	<input name="qformat" value="semtools" type="hidden" />
268
	<input name="includeHeader" value="false" type="hidden" />
241 269
	<input name="action" value="semquery" type="hidden" />
242 270

  
243 271
	<table class="group group_border">
......
366 394
		</tr>
367 395
		<tr>
368 396
			<td colspan="3">
369
				<input type="submit" value="Search"/>
397
				<!-- input type="submit" value="Search"/ -->
370 398
				<input type="reset" value="Clear" onclick="$('#searchForm').get(0).reset(); initialize()"/>
371 399
			</td>
372 400
		</tr>
......
379 407
		 -->		
380 408
</form>
381 409

  
410
<div id="searchResults">
411
	Search Results
412
</div>
413

  
382 414
<!-- Included default search/login -->
383 415
<% if ( PropertyService.getProperty("spatial.runSpatialOption").equals("true") ) { %>
384 416
<script language="javascript">

Also available in: Unified diff