Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the Pre-Election and additional reporting date charts sortable #4581

Closed
2 tasks
Tracked by #138
djgarr opened this issue Apr 29, 2021 · 2 comments
Closed
2 tasks
Tracked by #138

Make the Pre-Election and additional reporting date charts sortable #4581

djgarr opened this issue Apr 29, 2021 · 2 comments
Assignees
Milestone

Comments

@djgarr
Copy link
Contributor

djgarr commented Apr 29, 2021

Summary

Updating the Pre-Election and additional reporting date charts for more sortability.

On the current (or as of 2020 pre-election and 2021 special election) charts, the only way to filter the chart is to choose a state from a drop down menu. The goal was to see if there was a way to sort the table chronologically as well (Public Records produces a PDF demonstrating the alphabetical and chronological reporting dates (https://www.fec.gov/resources/cms-content/documents/2020pdates.pdf)). This applies to the Congressional pre-election report table, as well as the coordinated communication, electioneering communication, federal election activity, and independent expenditure reporting tables.

image

Completion criteria

  • Create sortability on both election date and state for election tables
  • Test extra carefully - it's very important not to scramble the data
@djgarr djgarr changed the title Updates to the Pre-Election and additional reporting date charts Update(s) to the Pre-Election and additional reporting date charts Apr 29, 2021
@kathycarothers kathycarothers added this to the Sprint 15.5 milestone May 20, 2021
@kathycarothers kathycarothers changed the title Update(s) to the Pre-Election and additional reporting date charts Front end - Update(s) to the Pre-Election and additional reporting date charts Jul 29, 2021
@lbeaufort lbeaufort changed the title Front end - Update(s) to the Pre-Election and additional reporting date charts Make the Pre-Election and additional reporting date charts sortable Jul 29, 2021
@johnnyporkchops
Copy link
Contributor

johnnyporkchops commented Aug 4, 2021

While it's possible to add sort to a basic table with JS, the existence of the hidden footnote rows adds a layer of complexity making this very complicated, if not impossible. Given the complications involved, I think it's worth evaluating the priority for implementing this before trying to move forward.

@rfultz rfultz modified the milestones: Sprint 15.5, Sprint 15.6 Aug 13, 2021
@johnnyporkchops
Copy link
Contributor

johnnyporkchops commented Aug 16, 2021

Created two partially working prototypes for the the Congressional Pre-Reporting table but these are still not complete and only apply to that one table on a FullWidth page. The issue author, @djgarr has said that this feature is currently a nice-to-have and not a must-have so we agreed to shelve this work for now.
The possible approaches, for future reference, are to

  1. Export reporting-dates-tables.js as a module (instead of a "page)" and include jQuery datatables node-module via a require variable. Then apply datatables to the table in the script and enable its sorting functionality. (this one also requires making the footnotes to be added on-click instead of the current way of adding when the table loads(with hide/show on-click), so that there are no colspans that confuse Jq Datatables sorting functionality on-load)

    var $ = require('jquery');
    require('datatables.net');
    require('datatables.net-responsive');
    var moment = require('moment');
    
     ...
    
     $(this.dates_table).DataTable( { ....
    
     ```
    
    
  1. Use a native JS table sort function. Will likely also require making the footnotes to be added on-click instead of when the table loads so that there are no colspans that might confuse sorting functionality on-load)

@johnnyporkchops Has a version of the JS which uses new logic to add footnotes on-click, instead of the current on-load(with hide/show)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants