我试着提出这个问题,但是它使得它变得比它需要的更复杂,所以我试图简化它。
示例数据集,如下:
ms9ftwk,ms9ftdate,ms9fthome,ms9fth8pts,ms9fthlopts,ms9ftvs,ms9fta8pts,ms9ftalopts,ms9ftaway,ms9ftloc
1,1 / 1/2018,P1,0,0,VS,0,0,P6,LOC1
1,1 / 1/2018,P2,0,0,VS,0,0,P5,中Loc2
1,1 / 1/2018,P3,0,0,VS,0,0,P4,中Loc3
2,1 / 2/2018,P4,0,0,VS,0,0,P1,中Loc3
2,1 / 2/2018,P5,0,0,VS,0,0,P2,中Loc2
2,1 / 2/2018,P6,0,0,VS,0,0,P3,LOC1
我正在尝试构建一个Bootstrap 4卡,其标题显示标题中的周# - 日期(下面代码中的h4行)。我得到了第1周的第3个实例 - 1/1/2018,而不仅仅是一个。
//Build the Table Body for Schedule/Weekly Scores
var weeklytbb = '';
var entryweeklytbb = data.feed.entry;
for (var wk1 = 1; wk1 <= 18; wk1++) {
weeklytbb += '<div class="card border border-dark mb-3">';
for (var wtbb02 = wk1; wtbb02 < entryweeklytbb.length; wtbb02++) {
if( entryweeklytbb[wtbb02].gsx$ms9ftwk.$t == wk1 && entryweeklytbb[wtbb02].gsx$ms9ftdate.$t !== '') {
weeklytbb += '<h4 class="card-header bg-dark text-light text-center">Week ' + wk1 + ' - ' + entryweeklytbb[wtbb02].gsx$ms9ftdate.$t + '</h4>';
}
}
weeklytbb += '<div class="card-body p-0">';
weeklytbb += 'My Data Goes Here - This Already Works As Intended and is Irrelevant';
weeklytbb += '</div></div>';
}