112 |
112 |
if ($("#" + divId + "Search").val().length >= 3) {
|
113 |
113 |
$("#" + divId).jstree("search", $("#" + divId + "Search").val());
|
114 |
114 |
// now prune
|
115 |
|
prune(divId);
|
|
115 |
prune(divId, "jstree-search");
|
116 |
116 |
}
|
117 |
117 |
});
|
|
118 |
|
|
119 |
// toggle the active domain prune
|
|
120 |
$("#" + divId + "Only").click(
|
|
121 |
function () {
|
|
122 |
if ($("#" + divId + "Only").is(":checked")) {
|
|
123 |
// prune to active
|
|
124 |
prune(divId, "bold");
|
|
125 |
} else {
|
|
126 |
// reset
|
|
127 |
prune(divId, null);
|
|
128 |
}
|
|
129 |
});
|
118 |
130 |
|
119 |
131 |
// TODO: try to select the original node after refresh with active domain
|
120 |
132 |
//$("#" + divId).jstree("open_node", $(selectedNode));
|
121 |
133 |
//$("#" + divId).jstree("select_node", $(selectedNode));
|
122 |
134 |
});
|
123 |
135 |
}
|
124 |
|
function prune(divId) {
|
|
136 |
/**
|
|
137 |
* Prunes the given tree to inlcude the given matched class
|
|
138 |
**/
|
|
139 |
function prune(divId, matchClass) {
|
125 |
140 |
|
126 |
141 |
// show all nodes (reset)
|
127 |
142 |
$("#" + divId).find("li").show();
|
128 |
143 |
|
|
144 |
// done if we don't have any thing to prune
|
|
145 |
if (!matchClass) {
|
|
146 |
return;
|
|
147 |
}
|
|
148 |
|
129 |
149 |
// get all non-matched anchor tags
|
130 |
|
var nonmatches = $("#" + divId).find("a").not(".jstree-search");
|
|
150 |
var nonmatches = $("#" + divId).find("a").not("." + matchClass);
|
131 |
151 |
|
132 |
152 |
// get their parent nodes
|
133 |
153 |
nonmatches = $(nonmatches).parents("li");
|
... | ... | |
136 |
156 |
$(nonmatches).each(
|
137 |
157 |
function(index) {
|
138 |
158 |
// do any chidren match?
|
139 |
|
var childMatches = $(this).find("a.jstree-search");
|
|
159 |
var childMatches = $(this).find("a." + matchClass);
|
140 |
160 |
if (childMatches && childMatches.length > 0) {
|
141 |
161 |
return true;
|
142 |
162 |
}
|
143 |
163 |
// parent matches?
|
144 |
|
var parentMatches = $(this).parents("li").children("a.jstree-search");
|
|
164 |
var parentMatches = $(this).parents("li").children("a." + matchClass);
|
145 |
165 |
if (parentMatches && parentMatches.length > 0) {
|
146 |
166 |
return true;
|
147 |
167 |
}
|
... | ... | |
248 |
268 |
<tr>
|
249 |
269 |
<td>
|
250 |
270 |
<input type="text" id="activeMeasurementsSearch" />
|
|
271 |
Only active? <input type="checkbox" id="activeMeasurementsOnly" title="Show only active concepts"/>
|
251 |
272 |
<div class="select">
|
252 |
|
<div id="activeMeasurements" style="width: 100%; height: 100px; overflow: auto">
|
|
273 |
<div id="activeMeasurements" class="activeTree" style="width: 100%">
|
253 |
274 |
<p>loading...</p>
|
254 |
275 |
</div>
|
255 |
276 |
<input type="hidden" class="value" name="activeMeasurementsValue" id="activeMeasurementsValue"/>
|
... | ... | |
274 |
295 |
<tr>
|
275 |
296 |
<td>
|
276 |
297 |
<input type="text" id="activeEntitiesSearch" />
|
|
298 |
<input type="checkbox" id="activeEntitiesOnly" title="Show only active concepts" />
|
277 |
299 |
<div class="select">
|
278 |
|
<div id="activeEntities" style="width: 216px; height: 100px; overflow: auto">
|
|
300 |
<div id="activeEntities" class="activeTree">
|
279 |
301 |
<p>loading...</p>
|
280 |
302 |
</div>
|
281 |
303 |
<input type="hidden" class="value" name="activeEntitiesValue" id="activeEntitiesValue"/>
|
... | ... | |
298 |
320 |
<tr>
|
299 |
321 |
<td>
|
300 |
322 |
<input type="text" id="activeCharacteristicsSearch" />
|
|
323 |
<input type="checkbox" id="activeCharacteristicsOnly" title="Show only active concepts" />
|
301 |
324 |
<div class="select">
|
302 |
|
<div id="activeCharacteristics" style="width: 216px; height: 100px; overflow: auto">
|
|
325 |
<div id="activeCharacteristics" class="activeTree">
|
303 |
326 |
<p>loading...</p>
|
304 |
327 |
</div>
|
305 |
328 |
<input type="hidden" class="value" name="activeCharacteristicsValue" id="activeCharacteristicsValue"/>
|
... | ... | |
322 |
345 |
<tr>
|
323 |
346 |
<td>
|
324 |
347 |
<input type="text" id="activeProtocolsSearch" />
|
|
348 |
<input type="checkbox" id="activeProtocolsOnly" title="Show only active concepts" />
|
325 |
349 |
<div class="select">
|
326 |
|
<div id="activeProtocols" style="width: 216px; height: 100px; overflow: auto">
|
|
350 |
<div id="activeProtocols" class="activeTree">
|
327 |
351 |
<p>loading...</p>
|
328 |
352 |
</div>
|
329 |
353 |
<input type="hidden" class="value" name="activeProtocolsValue" id="activeProtocolsValue" />
|
add checkbox for active domain pruning on each tree.