Skip to content
Snippets Groups Projects
Commit 9eba09d3 authored by Nicole Finks's avatar Nicole Finks
Browse files

[update logic]

parent 3eb88fb5
2 merge requests!9Develop,!8Repository
......@@ -63,26 +63,36 @@
<body>
<script>
$(document).ready(function(){
var results = [];
var data = {{ index .Site.Data.scRNAseq_huPr_D.updated_cleaned_json }};
/*$(document).ready(function(){
//declare global vars
var results = []; //array of records that match the filters
var data = {{ index .Site.Data.scRNAseq_huPr_D.updated_cleaned_json }};
var numbers = $("#filter").find(".numbers"); //array of all the places we want to update with the # of records that match the filters
var filters = [];
//filtering function
$("input").click(function(){
// get specific vars
var name = $(this).attr("name");
var value = $(this).attr("value");
var id = name + value;
id= id.replace(/\s+/g, '');
// if checkbox is checked: add filter values to filter
if ($(this).prop("checked") == true){
var i;
for (i =0; i < data.length; i++){
if( data[i][name] == value){
results.push(data[i]);
$('#'+id).text(results.length);
$("#"+id).text[numbers.length];
}
}
}
//if checkbox is not checked: remove filter values from filter
else if ($(this).prop("checked") == false){
var i;
for (i=0; i<results.length; i++){
......@@ -91,15 +101,29 @@ $(document).ready(function(){
i--;
}
}
$('#'+id).text(results.length);
}
//check data to pull all records that match the current filters
var i;
var j;
for (i = 0; i<numbers.length; i++){
var count = 0;
$('#displayFiles').text(numbers.length);
for (j=0; j <results.length; j++){
var id2 = results[j][name]. + results[j][name];
// id2 = id2.replace(/\s+/g, '');
// $('#displayFiles').text(id2);
if (id2 == numbers[i][id]){
count++;
$('#displayFiles').text(count);
}
}
}
});
});
*/
</script>
</body>
......
//$(document).ready(function(){
//* Loop through all dropdown buttons to toggle between hiding and showing its dropdown content - This allows the user to have multiple dropdowns without any conflict */
var dropdown = document.getElementsByClassName("dropdown-btn");
var i;
......@@ -16,6 +19,65 @@ for (i = 0; i < dropdown.length; i++) {
//* Get files matching filters*/
/* Get files matching filters
//declare global vars
var results = []; //array of records that match the filters
var data = {{ index .Site.Data.scRNAseq_huPr_D.updated_cleaned_json }};
var numbers = $("#filter").find(".numbers"); //array of all the places we want to update with the # of records that match the filters
var filters = [];//array of current filters
//filtering function
$("input").click(function(){
// get specific vars
var name = $(this).attr("name");
var value = $(this).attr("value");
var id = name + value;
id= id.replace(/\s+/g, '');
var filterVar = {"name": name, "value":value, "id":id};
// if checkbox is checked: add filter values to filter
if ($(this).prop("checked") == true){
filters.push(filterVar);
/* var i;
for (i =0; i < data.length; i++){
if( data[i][name] == value){
results.push(data[i]);
$("#"+id).text[numbers.length];
}
}*/
/* }
//if checkbox is not checked: remove filter values from filter
else if ($(this).prop("checked") == false){
var i;
for (i=0; i<filter.length; i++){
if (filter[i][id]== id){
filter.splice(i, 1);
i--;
}
}
}
//check data to pull all records that match the current filters
var i;
var j;
for (i = 0; i<filters.length; i++){
var count = 0;
$('#displayFiles').text(numbers.length);
for (j=0; j <data.length; j++){
// var id2 = results[j][name]. + results[j][name];
// id2 = id2.replace(/\s+/g, '');
// $('#displayFiles').text(id2);
if (id2 == numbers[i][id]){
count++;
$('#displayFiles').text(count);
}
}
}
});
});
*/
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment