Last change
on this file since 2150 was
2150,
checked in by work@…, 11 years ago
|
added more ajax calls, and improved first study compare wizard page
|
File size:
1.4 KB
|
Line | |
---|
1 | <% |
---|
2 | /** |
---|
3 | * first wizard page / tab |
---|
4 | * |
---|
5 | * @author Jeroen Wesbeek |
---|
6 | * @since 20120123 |
---|
7 | * |
---|
8 | * Revision information: |
---|
9 | * $Rev: 67319 $ |
---|
10 | * $Author: duh $ |
---|
11 | * $Date: 2010-12-22 17:45:42 +0100 (Wed, 22 Dec 2010) $ |
---|
12 | */ |
---|
13 | %> |
---|
14 | <af:page> |
---|
15 | <script type="text/javascript"> |
---|
16 | var criteria = {}; |
---|
17 | |
---|
18 | function handleCheckEvent(event) { |
---|
19 | var check = $(event); |
---|
20 | var value = check.attr('value'); |
---|
21 | var parent = check.parent(); |
---|
22 | var parentId = parent.attr('id'); |
---|
23 | if (criteria[parentId] == undefined) criteria[parentId] = []; |
---|
24 | var c = criteria[parentId]; |
---|
25 | |
---|
26 | // add or remove data |
---|
27 | if (check.is(':checked') && c.indexOf(value) < 0) { |
---|
28 | c.push(value); |
---|
29 | } else if (c.indexOf(value) >= 0) { |
---|
30 | c.splice(c.indexOf(value),1); |
---|
31 | } |
---|
32 | |
---|
33 | console.log(criteria); |
---|
34 | |
---|
35 | // ajax call |
---|
36 | $.getJSON( |
---|
37 | "<g:createLink controller="ajax" action="studyCount"/>", |
---|
38 | criteria, |
---|
39 | function(data) { |
---|
40 | $('#matchedStudies').html(data.count+' studies matched your criteria'); |
---|
41 | } |
---|
42 | ); |
---|
43 | |
---|
44 | // $.ajax({ |
---|
45 | // url: baseUrl + "/ajax/studyCount", |
---|
46 | // dataType: 'json', |
---|
47 | // data: data, |
---|
48 | // success: function(data) { |
---|
49 | // $('#matchedStudies').html(data.count+' studies matched your criteria'); |
---|
50 | // } |
---|
51 | // }); |
---|
52 | |
---|
53 | } |
---|
54 | </script> |
---|
55 | |
---|
56 | |
---|
57 | <div class="selector"> |
---|
58 | <div name="species" id="uniqueSpecies" class="ajax"></div> |
---|
59 | <div name="event templates" id="uniqueEventTemplateNames" class="ajax"></div> |
---|
60 | <div name="sampling event templates" id="uniqueSamplingEventTemplateNames" class="ajax"></div> |
---|
61 | </div> |
---|
62 | <div id="matchedStudies"></div> |
---|
63 | |
---|
64 | </af:page> |
---|
Note: See
TracBrowser
for help on using the repository browser.