Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// add new element to the end
if (diffAdded.length > 0) {
diffAdded.forEach((d) => {
this.orderedSelectionIndicies.push(d);
});
}
// remove elements within, but preserve order
if (diffRemoved.length > 0) {
diffRemoved.forEach((d) => {
this.orderedSelectionIndicies.splice(this.orderedSelectionIndicies.indexOf(d), 1);
});
}
const ids = rlist(this.orderedSelectionIndicies.map((i) => this.idAccessor(this._rows[i])));
//console.log(this.orderedSelectionIndicies, ids.toString(), diffAdded, diffRemoved);
const selection: ISelection = {idtype: this.idType, range: ids};
// Note: listener of that event calls LineUpSelectionHelper.setItemSelection()
this.fire(LineUpSelectionHelper.SET_ITEM_SELECTION, selection);
}
rowIdsAsSet(indices: number[]) {
let ids: number[];
if (indices.length === this._rows.length) {
ids = this._rows.map((d) => this.idAccessor(d));
} else {
ids = indices.map((i) => this.index2id.get(String(i)));
}
ids.sort((a, b) => a - b); // sort by number
return rlist(ids);
}