canvas-datagrid 0.3.15 → 0.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/draw.js CHANGED
@@ -1102,11 +1102,17 @@ export default function (self) {
1102
1102
 
1103
1103
  // Gaps may occur in row numbers between consecutively rendered rows
1104
1104
  // when we are filtering. We draw attention to this by drawing a thick
1105
- // border overlapping the two consecutive row headers.
1105
+ // border overlapping the two consecutive row headers. If sorting, visible
1106
+ // row numbers stay the same (i.e. they don't correspond to the underlying
1107
+ // data's row number), so we do not show row gaps in that case.
1108
+ const isSorting =
1109
+ self.orderings.columns && self.orderings.columns.length > 0;
1110
+
1106
1111
  if (
1107
1112
  isRowHeader &&
1108
1113
  self.attributes.showRowNumbers &&
1109
- self.attributes.showRowNumberGaps
1114
+ self.attributes.showRowNumberGaps &&
1115
+ isSorting === false
1110
1116
  ) {
1111
1117
  const previousRowNumber = self.getBoundRowIndexFromViewRowIndex(
1112
1118
  rowOrderIndex - 1,
@@ -1367,22 +1367,18 @@ export default function (self) {
1367
1367
  self.sorters.string = function (columnName, direction) {
1368
1368
  var asc = direction === 'asc';
1369
1369
  return function (a, b) {
1370
- if (a[columnName] === undefined || a[columnName] === null) {
1371
- return 1;
1372
- }
1373
- if (b[columnName] === undefined || b[columnName] === null) {
1374
- return 0;
1375
- }
1370
+ const aValue = a[columnName] || '';
1371
+ const bValue = b[columnName] || '';
1376
1372
  if (asc) {
1377
- if (!a[columnName].localeCompare) {
1373
+ if (!aValue.localeCompare) {
1378
1374
  return 1;
1379
1375
  }
1380
- return a[columnName].localeCompare(b[columnName]);
1376
+ return aValue.localeCompare(bValue);
1381
1377
  }
1382
- if (!b[columnName].localeCompare) {
1378
+ if (!bValue.localeCompare) {
1383
1379
  return 1;
1384
1380
  }
1385
- return b[columnName].localeCompare(a[columnName]);
1381
+ return bValue.localeCompare(aValue);
1386
1382
  };
1387
1383
  };
1388
1384
  self.sorters.number = function (columnName, direction) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-datagrid",
3
- "version": "0.3.15",
3
+ "version": "0.3.17",
4
4
  "description": "Canvas based data grid web component. Capable of displaying millions of contiguous hierarchical rows and columns without paging or loading, on a single canvas element.",
5
5
  "main": "./dist/canvas-datagrid.js",
6
6
  "module": "./dist/canvas-datagrid.module.js",