DiagMan.js - RedPhantom/DiagManager GitHub Wiki

Updated to 22/01/2017-build, commit 9c581ee DiagMan (js/DiagMan.js) is used to:

  • Perform the search in the ICD-9 entries.
  • Add the results to the table.
  • Enable row-selection features.

doSearch()

Performs the search in the entries.

User Interface

$('#source').popover('hide') hides the Bootstrap tooltip indicating the source has been changed.


document.getElementById("table").innerHTML = '<thead><tr><th style="width: 10%;">ICD-9 ID</th><th style="width: 70%;">Long Description</th><th style="width: 20%;">Short Description</th></tr></thead>'; // clean the table

resets the table for the new results to be inserted.


Algorithm

The three definitions of _data, _term and _limit are used to define the parsed data array, the search query (terms) and the results to return, respectively.

A .selectable class is added to all of the result rows to enable selection of rows. Then, the rows and cells are added.

if (document.getElementById("table").rows.length <= _limit) {
    tbody.appendChild(row);
}

Limit the rows added to the document. This check is not added in the for section so the search is performed on all of the rows and not just the top _limit.

An animation is added as well.

$('#table').on('click',".selectable", function (event)

Upon clicking on a #table row which has the .selectable class added, a simple filtration is added to apply the bg-info or active (depends on the version) or any other utility class. Some console output is done as well.

⚠️ **GitHub.com Fallback** ⚠️