Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
display nb of filtered columns + open on sample tab by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromedockes committed Apr 26, 2024
1 parent 8f30050 commit 4b684d6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/skrubview/_data/templates/dataframe-sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</div>

<p>
<strong>{{ summary.n_rows }}</strong> rows ✕ <strong>{{ summary.n_columns }}</strong> columns.
<strong>{{ summary.n_rows }}</strong> rows ✕ <strong id="{{ report_id }}_display_n_columns">{{ summary.n_columns }}</strong> columns.
</p>


Expand Down
2 changes: 1 addition & 1 deletion src/skrubview/_data/templates/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ <h1>{{ summary.title }}</h1>
</div>
<script>
updateSelectedColsSnippet("{{ report_id }}", false);
document.getElementById("{{ columns_tab_button_id }}").click();
document.getElementById("{{ sample_tab_button_id }}").click();
</script>
</div>
1 change: 1 addition & 0 deletions src/skrubview/_data/templates/skrubview.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,5 @@ function onFilterChange(colFilterId) {
elem.dataset.isExcludedByFilter = "";
}
})
document.getElementById(`${reportId}_display_n_columns`).textContent = acceptedCols.length.toString();
}
2 changes: 2 additions & 0 deletions src/skrubview/_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def _get_column_filters(dataframe):
~s.string(),
s.categorical(),
~s.categorical(),
s.any_date(),
~s.any_date(),
]:
filters[re.sub(r"^\((.*)\)$", r"\1", repr(selector))] = selector.expand(
dataframe
Expand Down

0 comments on commit 4b684d6

Please sign in to comment.