Jump to content

Topic on Extension talk:LinkedWiki

Column Sorting in SGVizler2 Tables

5
Anchardo (talkcontribs)

Hi, I’m trying to enable sorting on all columns in SGVizler2 tables (with small arrows for ascending/descending order). Even with the ordering option set in DataTables (in commons.js), the columns are still showing as sorting_disabled. I’d like to be able to sort any column, not just the first one. Has anyone else run into this or know how to fix it?

Thanks for any help!

Karima Rafes (talkcontribs)

Can you reproduce this problem on Linkedwiki.com with the Wikidata endpoint? And share the link here. Thanks.

Anchardo (talkcontribs)
Karima Rafes (talkcontribs)

Hello,

I audited the code. So, the response is on this page: https://datatables.net/reference/option/columnDefs Without parameters with the option "targets", the columnDef disables the targets. (line 109 of file DataTable.ts disables the targets)

In the javascript of sgvizler, try to find the code: "'targets': c," and remove it. I think, it can fix quickly this problem. There will also be side effects on appearance (maybe?). Sparql controls the order in the columns. It's probably why I disabled this option.

I will add the possibility to control the targets in the next version but I dont know when... I created the ticket. https://phabricator.wikimedia.org/T375154

Anchardo (talkcontribs)

Thanks for your investigation!

I tried to comment the line '"'targets':c" in the sgvizler2.js file (+ add an option), but without visible change on my table. Since I am in a tight schedule I decided to simplify my tables (cf. also my other question of the PDFs - where not all the columns were visible) and to provide the ordering via SPARQL.

What could be useful in the future would be to document if it is possible to "overwrite" the current code via common.js or how to proceed to change this kind of thing.

Reply to "Column Sorting in SGVizler2 Tables"