@@ -55,6 +55,7 @@ async function refreshAll(date) {
5555
5656async function refreshDataTable ( date ) {
5757 const currentDateStr = date . toISOString ( ) . split ( "T" ) [ 0 ] ; // format YYYY-MM-DD;
58+ let currentValue = { } ;
5859 const { questionaryId, formKey } = navData ;
5960 const tableData = await patientLib . getHistoricalContent (
6061 questionaryId ,
@@ -73,14 +74,15 @@ async function refreshDataTable(date) {
7374 headerCell . innerHTML = th . label ;
7475 headerRow . appendChild ( headerCell ) ;
7576 }
76- for ( const [ dateStr , data ] of Object . entries ( tableData . valuesByDate ) ) {
77+ for ( const data of tableData . valuesByDate ) {
7778 const row = table . insertRow ( - 1 ) ;
78- if ( currentDateStr === dateStr ) {
79+ if ( currentDateStr === data . dateStr ) {
80+ currentValue = data ;
7981 row . style . backgroundColor = 'grey' ;
8082 }
8183
8284 const cellDate = row . insertCell ( - 1 ) ;
83- cellDate . innerHTML = dateStr ;
85+ cellDate . innerHTML = data . dateStr ;
8486 for ( const th of tableData . tableHeaders ) {
8587 const cell = row . insertCell ( - 1 ) ;
8688 const v = data [ th . fieldId ] ?. value ;
@@ -89,7 +91,7 @@ async function refreshDataTable(date) {
8991 }
9092
9193 console . log ( "## tabledata" , tableData ) ;
92- return tableData . valuesByDate [ currentDateStr ] || { } ;
94+ return currentValue ;
9395}
9496
9597// ------- Form -------- //
0 commit comments