Project

General

Profile

« Previous | Next » 

Revision 5668

-"Clear" button actually clears the form and refreshes the search results w/o constraints
-active domain check boxes are honored when refreshing active domain after selection is made in a different tree

View differences:

index.jsp
62 62
	// TODO: remember the selected value for this when filtering by active domain
63 63
	var selectedNode = $("#" + divId).jstree("get_selected", $("#" + divId));
64 64
	var selectedNodeId = $(selectedNode).attr("id");
65
	//alert(divId + " selected node: " + selectedNode);
65
	//alert(divId + " selected node: " + selectedNodeId);
66 66
	
67 67
	// load the tree for the given div, passing in the other filtered values
68 68
	$("#" + divId).load(
......
102 102
						},
103 103
						//"core" : { "initially_open" : [ selectedNodeId ] },
104 104
						"search" : { "case_insensitive" : true },
105
						"cookies" : { 
106
								"save_opened" : "jstree_open_" + divId,
107
								"save_selected" : "jstree_select_" + divId,
108
						},
105
						//"cookies" : { 
106
						//		"save_opened" : "jstree_open_" + divId,
107
						//		"save_selected" : "jstree_select_" + divId,
108
						//},
109 109
						"plugins" : [ 
110 110
							"themes", 
111 111
							"html_data", 
112 112
							"ui", 
113
							"cookies", 
113
							//"cookies", 
114 114
							"search" ]
115 115
					});
116 116
			});
......
126 126
				});
127 127
			
128 128
			// toggle the active domain prune
129
			$("#" + divId + "Only").click(
130
				function () {
131
					if ($("#" + divId + "Only").is(":checked")) {
132
						// prune to active
133
						prune(divId, "bold");
134
					} else {
135
						// reset
136
						prune(divId, null);
137
					}
138
				});	
129
			$("#" + divId + "Only").click(function() {
130
				doActiveDomain(divId);
131
			});	
139 132

  
140
			// TODO: make this work
141
			// open to the node
133
			// actually prune if we should
134
			doActiveDomain(divId);
135
			
136
			// open to the node to last selected
142 137
			var nodePath = $("#" + divId).jstree("get_path", $(selectedNode));
143
			//alert("nodePath=" + nodePath);
144 138
			if (nodePath) {
145 139
				for (var index = 0; index < nodePath.length; index++) {
146 140
					$("#" + divId).jstree("open_node", $("#" + nodePath[index]));
147
					//$("#" + divId).jstree("select_node", $("#" + nodePath[index]));
148 141
				}
149 142
				// select the original node
150 143
				$("#" + divId).jstree("select_node", $(selectedNode), false);
......
191 184
			$(this).hide();
192 185
		});
193 186
}
187
function doActiveDomain(divId) {
188
	if ($("#" + divId + "Only").is(":checked")) {
189
		// prune to active
190
		prune(divId, "bold");
191
	} else {
192
		// reset
193
		prune(divId, null);
194
	}
195
}
194 196
function initialize(source) {
195 197
	// we don't want to reload the source of the filtering request
196 198
	// but we do want to reload the other trees for active domains
......
261 263
	return false;
262 264
	
263 265
}
266
function clearForm() {
267
	// clear the form values
268
	$('#searchForm').get(0).reset();
269
	// clear each of the tree selections
270
	$(".jstree").each(function(index) {
271
		$(this).jstree("deselect_all");
272
	});
273
	$("input.value").each(function(index) {
274
		$(this).val("");
275
	});
276
	// reload the trees
277
	initialize();
278
	// reload the search results
279
	//alert($('#searchForm').get(0));
280
	doSearch($('#searchForm').get(0));
281
}
264 282
function donothing() {}
265 283
--></script>
266 284

  
......
416 434
		<tr>
417 435
			<td colspan="3">
418 436
				<!-- input type="submit" value="Search"/ -->
419
				<input type="reset" value="Clear" onclick="$('#searchForm').get(0).reset(); initialize()"/>
437
				<input type="reset" value="Clear" onclick="clearForm()"/>
420 438
			</td>
421 439
		</tr>
422 440
	</table>

Also available in: Unified diff