High-Performance UI Component Library for Enterprise Applications › Forums › Data Grid › software bug in smart.export.js 27.1.0
- This topic has 0 replies, 1 voice, and was last updated 1 day ago by
edwardsmarkff.
Viewing 1 post (of 1 total)
-
AuthorPosts
-
November 21, 2026 at 6:33 pm #113753
edwardsmarkff
Participanthello —
there appears there is a bug in smart.exports.js 27.1.0 as well as earlier releases.
When two “allowExport: false” statements are specified, it causes the following error:
Uncaught TypeError: compareFunctions[i] is not a function at smart.export.js:2538:59 at Array.sort (<anonymous>) at sortByMultipleColumns (smart.export.js:2536:28) at DataExporter.processGroupingInformation (smart.export.js:2557:13) at DataExporter.exportToPDF (smart.export.js:719:21) at DataExporter.exportData (smart.export.js:245:31) at Grid.exportData (smart.grid.export.js:1104:35) at Button.<anonymous> (transcription.html:1128:10)According to google-AI, the following fixes it: (starting at line 2536)
/*** dataSource.sort(function (a, b) { /*** for (let i = 0; i < sortColumns.length; i++) { /*** const result = compareFunctions[i](a[sortColumns[i]], b[sortColumns[i]]); /*** /*** if (result === 0) { /*** if (sortColumns[i + 1]) { /*** continue; /*** } /*** else if (a._index !== undefined) { /*** // makes sorting stable /*** return (a._index - b._index) * directionCoefficients[i]; /*** } /*** /*** return 0; /*** } /*** /*** return result * directionCoefficients[i]; /*** } /*** }); */ dataSource.sort(function (a, b) { for (let i = 0; i < sortColumns.length; i++) { const compareFn = typeof compareFunctions[i] === 'function' ? compareFunctions[i] : function (valA, valB) { if (valA === valB) { return 0; } if (valA === null || valA === undefined) { return -1; } if (valB === null || valB === undefined) { return 1; } return String(valA).localeCompare(String(valB)); }; const result = compareFn(a[sortColumns[i]], b[sortColumns[i]]); if (result === 0) { if (sortColumns[i + 1]) { continue; } else if (a._index !== undefined) { // makes sorting stable return (a._index - b._index) * directionCoefficients[i]; } return 0; } return result * directionCoefficients[i]; } });alternatively, i can patch my grid.exportData(‘pdf’) statement with the following:
const grid = document.querySelector('smart-grid'); // 1. Read the actual active grouped columns from grid.grouping.groupBy const savedGroups = (grid.grouping && Array.isArray(grid.grouping.groupBy)) ? [...grid.grouping.groupBy] : []; // 2. Clear grouping using Smart Grid's native API if (typeof grid.clearGrouping === 'function') { grid.clearGrouping(); } else if (grid.grouping) { grid.grouping.groupBy = []; } try { grid.exportData('pdf'); } finally { // 3. Restore the original groups immediately after export savedGroups.forEach(field => { if (typeof grid.addGroup === 'function') { grid.addGroup(field); } }); }since i want to use the compressed code, i will use the patch, unless your developers have a better suggestion.
-
This topic was modified 1 day ago by
edwardsmarkff.
-
This topic was modified 1 day ago by
edwardsmarkff.
-
This topic was modified 1 day ago by
edwardsmarkff.
-
This topic was modified 1 day ago by
edwardsmarkff.
-
This topic was modified 1 day ago by
-
AuthorPosts
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.