From cb57482d716a301879411befaf4df1d830b6f1c1 Mon Sep 17 00:00:00 2001 From: plukasew Date: Wed, 1 Sep 2021 12:30:18 -0400 Subject: [PATCH] SAK-46156 Improve gradebook JS rendering time in some browsers (#9735) --- .../tool/src/webapp/scripts/gradebook-gbgrade-table.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gradebookng/tool/src/webapp/scripts/gradebook-gbgrade-table.js b/gradebookng/tool/src/webapp/scripts/gradebook-gbgrade-table.js index 475516ea0095..dea43408a1c4 100644 --- a/gradebookng/tool/src/webapp/scripts/gradebook-gbgrade-table.js +++ b/gradebookng/tool/src/webapp/scripts/gradebook-gbgrade-table.js @@ -688,6 +688,10 @@ GbGradeTable.renderTable = function (elementId, tableData) { GbGradeTable.COURSE_GRADE_COLUMN_INDEX = GbGradeTable.FIXED_COLUMN_OFFSET - 1; // course grade is always the last fixed column GbGradeTable.domElement.addClass('gb-fixed-columns-' + GbGradeTable.FIXED_COLUMN_OFFSET); + if (sakai && sakai.locale && sakai.locale.userLanguage) { + GbGradeTable.numFmt = new Intl.NumberFormat(sakai.locale.userLanguage); + } + GbGradeTable.grades = GbGradeTable.mergeColumns(GbGradeTable.unpack(tableData.serializedGrades, tableData.rowCount, tableData.columnCount), @@ -3121,8 +3125,8 @@ GbGradeTable.localizeNumber = function(number) { return; } - if (sakai && sakai.locale && sakai.locale.userLanguage) { - return parseFloat(number).toLocaleString(sakai.locale.userLanguage); + if (GbGradeTable.numFmt) { + return GbGradeTable.numFmt.format(parseFloat(number)); } return '' + number;