按老师数量设置查询结果默认折叠
This commit is contained in:
@@ -123,6 +123,13 @@ function groupRecordsByTeacher(records) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initializeTeacherGroupCollapse(records) {
|
||||||
|
const groups = groupRecordsByTeacher(records);
|
||||||
|
collapsedTeacherGroups = groups.length > 1
|
||||||
|
? new Set(groups.map((group) => group.teacher))
|
||||||
|
: new Set();
|
||||||
|
}
|
||||||
|
|
||||||
function getDisplayRecord(row) {
|
function getDisplayRecord(row) {
|
||||||
return correctedRecords.get(row._recordKey) || row;
|
return correctedRecords.get(row._recordKey) || row;
|
||||||
}
|
}
|
||||||
@@ -811,6 +818,9 @@ async function queryRecords(query, options = {}) {
|
|||||||
_recordIndex: currentRecordPage.offset + index,
|
_recordIndex: currentRecordPage.offset + index,
|
||||||
_recordKey: makeRecordKey(row, currentRecordPage.offset + index),
|
_recordKey: makeRecordKey(row, currentRecordPage.offset + index),
|
||||||
}));
|
}));
|
||||||
|
if (options.reset !== false) {
|
||||||
|
initializeTeacherGroupCollapse(currentRecords);
|
||||||
|
}
|
||||||
recordRows.innerHTML = renderGroupedRecords(currentRecords);
|
recordRows.innerHTML = renderGroupedRecords(currentRecords);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
recordRows.innerHTML = `<tr><td colspan="${RECORD_TABLE_COLUMN_COUNT}" class="empty">查询失败:${escapeHtml(error.message)}</td></tr>`;
|
recordRows.innerHTML = `<tr><td colspan="${RECORD_TABLE_COLUMN_COUNT}" class="empty">查询失败:${escapeHtml(error.message)}</td></tr>`;
|
||||||
|
|||||||
Reference in New Issue
Block a user