Skip to content

Commit

Permalink
Fix: Using array based data with view total and cascade would cause a…
Browse files Browse the repository at this point in the history
…n incorrect count to be shown

DD-2544
https://datatables.net/forums/discussion/72669
  • Loading branch information
AllanJard committed May 9, 2022
1 parent 0b189b3 commit 7f34b04
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/SearchPaneST.ts
Expand Up @@ -204,13 +204,27 @@ export default class SearchPaneST extends SearchPane {
* @param bins The bins object that is to be incremented
*/
protected _updateShown(rowIdx: number, settings, bins = this.s.rowData.binsShown): void {
let filter = settings.oApi._fnGetCellData(settings, rowIdx, this.s.index, this.s.colOpts.orthogonal.search);
let orth = typeof this.s.colOpts.orthogonal === 'string'
? this.s.colOpts.orthogonal
: this.s.colOpts.orthogonal.search;

let filter = settings.oApi._fnGetCellData(settings, rowIdx, this.s.index, orth);
let add = (f) => {
if (!bins[f]) {
bins[f] = 1;
}
else {
bins[f] ++;
}
};

if (!bins[filter]) {
bins[filter] = 1;
if (Array.isArray(filter)) {
for (let f of filter) {
add(f);
}
}
else {
bins[filter] ++;
add(filter);
}
}
}

0 comments on commit 7f34b04

Please sign in to comment.