simonw / datasette-column-inspect

Experimental plugin that adds a column inspector
Apache License 2.0
3 stars 0 forks source link

Plugin breaks on pages that have applied a filter #3

Open simonw opened 4 years ago

simonw commented 4 years ago
fivethirtyeight__antiquities-act_actions_under_antiquities_act__19_rows_where_where_pres_or_congress____C__Coolidge__-_Mozilla_Firefox
simonw commented 4 years ago

Bug is here: https://github.com/simonw/datasette-column-inspect/blob/3b117cbaf7a7cf706098e5d7e334cc8cd3b960bb/datasette_column_inspect/templates/table.html#L49

simonw commented 4 years ago

OK, I fixed that bug... but there's a much worse one. The SQL queries generated in the JavaScript don't take the current page filters into account, so the numbers they display apply to the main table, not to the filtered version.

Fixing this is going to be a lot harder. It may require a complete overhaul of how the plugin works under the hood.

simonw commented 4 years ago

Or... I bet I can fix it by exposing the SQL query used on the page (using a template variable) and then rewriting the SQL queries to use subselects.

That could even eventually mean this plugin can work on the arbitrary database query SQL results page!