HEPData / hepdata

Repository for main HEPData web application
https://hepdata.net
GNU General Public License v2.0
40 stars 11 forks source link

records: use default `HEPDATA.selected = {}` rather than `undefined` #774

Closed GraemeWatt closed 6 months ago

GraemeWatt commented 6 months ago

For tables with more than 50 rows where points are not selected with the "brushing" option, for example, the first table of https://www.hepdata.net/record/ins2752118 , clicking "Show All 1358 values" gives a JavaScript error message in the console: TypeError: e is not an Object. (evaluating 'n().select(this).attr("id").split("-")[1]in e') from this line:

https://github.com/HEPData/hepdata/blob/87765344d0359b39e647a86c1560d1a19d20bded/hepdata/modules/records/assets/js/hepdata_tables.js#L511

called from:

https://github.com/HEPData/hepdata/blob/87765344d0359b39e647a86c1560d1a19d20bded/hepdata/modules/records/assets/js/hepdata_tables.js#L502

A simple fix would be to use a default value of HEPDATA.selected = {} rather than:

https://github.com/HEPData/hepdata/blob/87765344d0359b39e647a86c1560d1a19d20bded/hepdata/modules/records/assets/js/hepdata_common.js#L21