Skip to content

Commit b5723a2

Browse files
authored
Fix dialog data model filter logic (#143)
* fix dialog datamodel filter logic * add semicolons
1 parent 17be0ec commit b5723a2

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/core/filterMenu.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ export class InteractiveFilterDialog extends BoxPanel {
133133

134134
const value = this._mode === 'condition'
135135
? <Transform.FilterValue>this._filterValue
136-
: this._uniqueValueStateManager.getIndices(this.region, this._columnIndex).map(row => {
137-
return this._uniqueValueGrid.dataModel!.data('body', row, 0);
138-
});
136+
: this._uniqueValueStateManager.getValues(this.region, this._columnIndex);
139137

140138
// Construct transform
141139
const transform: Transform.TransformSpec = {
@@ -1018,7 +1016,7 @@ export class UniqueValueStateManager {
10181016
MessageLoop.postMessage(this._grid.viewport, msg);
10191017
}
10201018

1021-
getIndices(region: DataModel.CellRegion, columnIndex: number): any[] {
1019+
getValues(region: DataModel.CellRegion, columnIndex: number): any[] {
10221020
const key = this.getKeyName(region, columnIndex)
10231021
if (this._state.hasOwnProperty(key)) {
10241022
return Array.from(this._state[key])
@@ -1048,10 +1046,10 @@ class UniqueValueGridMouseHandler extends BasicMouseHandler {
10481046
//@ts-ignore added so we don't have to add basicmousehandler.ts fork
10491047
onMouseDown(grid: DataGrid, event: MouseEvent): void {
10501048
const hit = grid.hitTest(event.clientX, event.clientY);
1051-
1052-
let value = hit.row
1049+
const row = hit.row;
10531050
const colIndex = this._filterDialog.columnIndex;
1054-
const region = this._filterDialog.region
1051+
const region = this._filterDialog.region;
1052+
const value = grid.dataModel!.data('body', row, 0);
10551053

10561054
if (this._uniqueValuesSelectionState.has(region, colIndex, value)) {
10571055
this._uniqueValuesSelectionState.remove(region, colIndex, value)

src/core/valueRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export class FilterValueRenderer extends TextRenderer {
132132

133133
// Check state to display checkbox
134134

135-
if (this._stateManager.has(this._dialog.region, this._dialog.columnIndex, config.row)) {
135+
if (this._stateManager.has(this._dialog.region, this._dialog.columnIndex, config.value)) {
136136
gc.beginPath();
137137
gc.strokeStyle = "#000000";
138138
gc.moveTo(config.x + BOX_OFFSET + 3, config.y + BOX_OFFSET + 5);

0 commit comments

Comments
 (0)