Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Issue 370 - Clearing filtering_settings clears the by-column filter UI #372

Merged
merged 11 commits into from
Feb 19, 2019

Conversation

Marc-Andre-Rivet
Copy link
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet commented Feb 12, 2019

Fixes #370.
Relates to https://community.plot.ly/t/clearing-filters-in-a-datatable/19381/2

Two problems here:

  • the UI was not picking up the updated value for the column filters
  • the syntax tree was evaluating empty queries as invalid -- preventing them from being processed further (this is done to prevent the UI from updating with invalid values when typing in a new / potentially invalid query fragment for a column) -- small change of logic here

Marc-André Rivet added 4 commits February 12, 2019 15:45
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-372 February 12, 2019 23:57 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-372 February 12, 2019 23:57 Inactive
}}
>Clear Filter</button>);
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this new case, need an additional button to trigger the filter reset -- either that or make this a full on e2e test, which I think is pointless.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mode based conditional additional comps

{...this.state.tableProps}
/>);
return (<div>
{this.renderMode()}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditionals added with the table

export const BasicModes = [
...ReadWriteModes,
AppMode.ReadOnly
];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each time we added a mode we were running the standalone tests against an additional mode. In most cases, we want a new mode to test specific aspects of the table not all cases.

});
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The input needs to update its internal state when the value/prop updates. That prevented the UI from updating to match the filter.

false;
return this.tree && this.tree.lexeme && this.tree.lexeme.evaluate ?
this.tree.lexeme.evaluate(target, this.tree) :
true;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A valid null tree (no query string) now evaluates to true (the target matches the criteria)

@@ -64,6 +64,10 @@ export default (lexerResult: ILexerResult): ISyntaxerResult => {
return { valid: false, error: `lexer -- ${lexerResult.error}` };
}

if (lexerResult.lexemes.length === 0) {
return { valid: true };
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having no query string is now a valid / null tree case instead of an invalid case

});
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was dead code -- dating back to before the IsolatedInput was added - nothing depends on the state here, removing.

if (!tree) {
this.ops.clear();
return;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When rebuilding the fragments, clear all fragments if there's no query


DashTable.getCellById(0, 'rows').within(() => cy.get('.dash-cell-value').should('have.html', '101'));
DashTable.getCellById(1, 'rows').should('not.exist');
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird diff here but nothing changed

DashTable.getCellById(1, 'rows').should('not.exist');
DashTable.getCellById(0, 'ccc').within(() => cy.get('.dash-cell-value').should('have.html', cell_0));
DashTable.getCellById(1, 'ccc').within(() => cy.get('.dash-cell-value').should('have.html', cell_1));
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply a filter column by column, see that it's applied, clear it, see that it's not applied anymore!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And make sure the fields are empty -- as per described issue

@chriddyp chriddyp temporarily deployed to dash-table-review-pr-372 February 13, 2019 00:08 Inactive
@Marc-Andre-Rivet
Copy link
Contributor Author

Need to do changelog!

@chriddyp chriddyp temporarily deployed to dash-table-review-pr-372 February 13, 2019 00:13 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-372 February 13, 2019 15:22 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-372 February 15, 2019 19:45 Inactive
Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the delay reviewing, looks great! 💃

@Marc-Andre-Rivet Marc-Andre-Rivet merged commit e144584 into master Feb 19, 2019
@Marc-Andre-Rivet Marc-Andre-Rivet deleted the community-19381 branch February 19, 2019 16:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants