Skip to content

Commit

Permalink
Merge pull request #490 from jpmorganchase/keep-filter-col-in-grid
Browse files Browse the repository at this point in the history
Ensure that filter column stays active when filtering
  • Loading branch information
texodus authored Mar 20, 2019
2 parents 09d296a + 1d3304a commit e7b380c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/perspective-viewer/src/js/viewer/dragdrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export function drop(ev) {
if (data_index !== -1) {
columns.splice(data_index, 1);
}
if (name.indexOf("filter") > -1) {

const filtering = name.indexOf("filter") > -1;
if (filtering) {
this.setAttribute(name, JSON.stringify(columns.concat([data])));
} else if (name.indexOf("sort") > -1) {
this.setAttribute(name, JSON.stringify(columns.concat([[data[0]]])));
Expand All @@ -68,7 +70,7 @@ export function drop(ev) {
}

// Deselect the dropped column
if (this._plugin.deselectMode === "pivots" && this._get_visible_column_count() > 1 && name !== "sort" && name !== "filter") {
if (this._plugin.deselectMode === "pivots" && this._get_visible_column_count() > 1 && name !== "sort" && !filtering) {
for (let x of this.shadowRoot.querySelectorAll("#active_columns perspective-row")) {
if (x.getAttribute("name") === data[0]) {
this._active_columns.removeChild(x);
Expand Down

0 comments on commit e7b380c

Please sign in to comment.