I am trying to us Fuse to create a front-end search for a JSON database. Fuse is very fast, but I can’t figure out how to write the table to the HTML in a speedy way.
I have tried pure JS:
for (row in resultsArray){
dRow = resultsArray[row]
table.innerHTML += "<tr>" + "<td>" + dRow["item"]["title_translit"] + "</td>" + "<td>" + dRow["item"]["translator"][0]["name_translit"] + "</td>" + "</tr>"
}
/*
jQuery.each(resultsArray, function(idx, row) {
table.innerHTML += "<tr>" + "<td>" + row["item"]["title_translit"] + "</td>" + "<td>" + row["item"]["translator"][0]["name_translit"] + "</td>" + "</tr>"
})
*/
};
As well as jQuery:
jQuery.each(resultsArray, function(idx, row) {
table.innerHTML += "<tr>" + "<td>" + row["item"]["title_translit"] + "</td>" + "<td>" + row["item"]["translator"][0]["name_translit"] + "</td>" + "</tr>"
})
But in both cases, it takes a few seconds to write the array of dicts (which is about 2,000 rows in total) to HTML tables. Is there a faster way to do this?