Skip to content

Commit

Permalink
#789 Fixes evidenceTable infinitescrolling bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
lawal-olaotan committed Sep 15, 2023
1 parent d28735d commit 25c0160
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions client-base/src/main/webapp/html/javascript/evidence-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,6 @@ function createEvidenceTable( tableData, doSortTable=false )
evidenceTableScroller.setupScrollHandler ()
}





/*
* Function
* Generates multi evidence network in KnetMaps
Expand Down Expand Up @@ -416,19 +412,19 @@ function createEvidenceTableBody ( tableData, doAppend = false )
*
* if it's a bug, fix it with a loop over the right window
*/
tableData.forEach( (evidence,index) =>
{
let {conceptType, name, pvalue, totalGenesSize, ondexId, userGenesSize, userGeneAccessions } = evidence

for(var row = fromRow; row < toRow; row++){

let {conceptType, name, pvalue, totalGenesSize, ondexId, userGenesSize, userGeneAccessions } = tableData[row]

// Prefer this templating style, at least for new code
// Also, avoid "x = x + ...", it's more verbose than +=, especially when
// it's needed many times.
//
tableBody +=`<tr>
<td>
<p onclick="evidenceTableExcludeKeyword(${ondexId},this,event)" id="evidence_exclude_${index}" style="padding-right:10px;" class="excludeKeyword evidenceTableExcludeKeyword" title="Exclude term"></p>
<p onclick="evidenceTableAddKeyword(${ondexId},this,event)" id="evidence_add_${index}" class="addKeyword evidenceTableAddKeyword" title="Add term"></p>
<p onclick="evidenceTableExcludeKeyword(${ondexId},this,event)" id="evidence_exclude_${row}" style="padding-right:10px;" class="excludeKeyword evidenceTableExcludeKeyword" title="Exclude term"></p>
<p onclick="evidenceTableAddKeyword(${ondexId},this,event)" id="evidence_add_${row}" class="addKeyword evidenceTableAddKeyword" title="Add term"></p>
</td>`;

//link publications with pubmed
Expand Down Expand Up @@ -459,11 +455,13 @@ function createEvidenceTableBody ( tableData, doAppend = false )
tableBody += ` <td ><span style="margin-right:.5rem;">${totalGenesSize}</span> <span data-type="${conceptType}" data-description="${name}" class="accession-download" onclick="openGeneListPopup(${ondexId},this)"><i class="fas fa-file-download"></i></span> <div id="concept${ondexId}"></div></td>\n`;

// launch evidence network with them, if they're not too many.
tableBody += ` <td><button data-genelist="${userGeneAccessions}" style="${userGenesSize == 0 ? 'text-decoration:none;': null}" onclick="openAccessionNetworkView(${ondexId},event)" class="userGenes_evidenceNetwork" title="Display in KnetMaps" id="userGenes_evidenceNetwork_${index}">${userGenesSize}</button></td>\n`;
tableBody += ` <td><button data-genelist="${userGeneAccessions}" style="${userGenesSize == 0 ? 'text-decoration:none;': null}" onclick="openAccessionNetworkView(${ondexId},event)" class="userGenes_evidenceNetwork" title="Display in KnetMaps" id="userGenes_evidenceNetwork_${row}">${userGenesSize}</button></td>\n`;

var select_evidence = `<input onchange="updateSelectedGenesCount('evidences', '#evidence-count', 'Term');" id="checkboxEvidence_${index}" type="checkbox" name= "evidences" value="${ondexId}:${userGeneAccessions}">`;
var select_evidence = `<input onchange="updateSelectedGenesCount('evidences', '#evidence-count', 'Term');" id="checkboxEvidence_${row}" type="checkbox" name= "evidences" value="${ondexId}:${userGeneAccessions}">`;
tableBody += ` <td>${select_evidence}</td>\n`; // eviView select checkbox
})

}


if ( tableBody )
{
Expand Down

0 comments on commit 25c0160

Please sign in to comment.