From a389ffa946c2f0aca811a1615df533e309ea7935 Mon Sep 17 00:00:00 2001 From: sairajzero Date: Sun, 30 May 2021 18:27:40 +0530 Subject: [PATCH] Display sorted order Display the funds in sorted by the start date (newest first) --- index.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index add6987..edc8ea8 100644 --- a/index.html +++ b/index.html @@ -10898,6 +10898,7 @@ Bitcoin.Util = { } const fundsFrag = document.createDocumentFragment() + let sortArray = []; for (let k in funds) { let f = parseFunds(funds[k]); @@ -10979,9 +10980,16 @@ Bitcoin.Util = { fundBlock.data = fundObj removeElementIfExist(k); fundBlock.id = k; - getRef('fund_list').append(fundBlock); + let i = sortArray.length - 1; + while (i >= 0 && sortArray[i] < startDate) { //[9, 7, 5, 3] + sortArray[i + 1] = sortArray[i] + i--; + } + sortArray[i + 1] = startDate; + let list = getRef('fund_list') + list.insertBefore(fundBlock, list.childNodes[i + 1]); } - + //const fundGroup = document.createElement('section') //fundGroup.dataset.floId = term.floID //fundGroup.classList.add('fund-option')