Project

General

Profile

Feature #7284

tablesorter: save sort order / column selection on server

Added by Carsten Rose 7 months ago. Updated 1 day ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
Start date:
18.11.2018
Due date:
23.05.2019
% Done:

100%

Estimated time:
Discuss:

Description

  • Es waere gut wenn der User seine Einstellung zu einer tablesorter Tabelle speichern koennte, so dass beim naechsten Aufruf wieder die gleiche Einstellung da waere.
  • Soll ein Excel Export der Tabelle, mit Beruecksichtigung der aktuellen Einstellungen, erfolgen, muessen diese Settings zwingend auf dem Server gespeichert werden. Mit dieser Anforderung, koennten die Tablesettings dann gleich durch den Server vorbelegt werden.
  • Idee: Gut waere ein API CallBack (bei jeder Aenderung), der die Settings auf dem Server speichert. Dazu wird beim ausliefern der Tabelle eine SIP zur Authorisierung mitgeliefert.

Requirement 2: Auf einer Seite gibt es mehrere Filtersettings (#6936) die definiert und abgerufen werden koennen. Eine Moeglichhkeit waere das aktuelle Setting der Spalten (Anzeige/Sortierung) beim speichern des Filters mit abzulegen.


Related issues

Has duplicate QFQ - Feature #8172: Report: Spalten dynamisch ein/ausblenden und filterbar machenRejected2019-04-03

Associated revisions

Revision edd439b0
Added by Carsten Rose 1 day ago

Merge branch 'F7284tablesorterSaveSortOrder' into 'master'

F7284tablesorter save sort order

See merge request typo3/qfq!164

History

#1 Updated by Carsten Rose 4 months ago

  • Description updated (diff)
  • Priority changed from Normal to High
  • Target version changed from next to 19.6.3

#9 Updated by Carsten Rose 3 months ago

  • Status changed from New to In Progress

#10 Updated by Carsten Rose 3 months ago

  • Status changed from In Progress to New

#12 Updated by Marc Egger about 2 months ago

  • Assignee set to Marc Egger

#13 Updated by Marc Egger about 2 months ago

  • Due date set to 09.05.2019

#14 Updated by Marc Egger about 2 months ago

current workaround with buttons above report:

<span onClick="$(this).siblings('.tablesorter-column-selector').trigger('refreshColumnSelector', [ [0,1,2,3,4,5,6] ]);" class="btn btn-default">show main columns</span>
<span onClick="$(this).siblings('.tablesorter-column-selector').trigger('refreshColumnSelector', [ [...Array(100).keys()] ]);" class="btn btn-default">show all columns</span>

#15 Updated by Marc Egger about 2 months ago

Add css class class="columnSelector-false" to <th> to disable a column by default. Gets overwritten by saved user selection.

#16 Updated by Marc Egger about 2 months ago

set and get the state of the tablesorter with javascript. Use JSON.parse() and JSON.stringify() to save in database.

function setTablesorterState(table, newState) {
    if(newState.hasOwnProperty('columnSelection') && $.tablesorter.hasWidget( table, 'columnSelector')) {
        table.trigger('refreshColumnSelector', [ newState.columnSelection ]);
    }
    if(newState.hasOwnProperty('filters') && $.tablesorter.hasWidget( table, 'filter')) {
        $.tablesorter.setFilters(table, newState.filters);
    }
    if(newState.hasOwnProperty('sortList')) {
        table.trigger( 'sorton', [ newState.sortList ] );
    }
}

function getTablesorterState(table, columnSelection=true, filters=true, sortList=true) {
    var state = {}
    var config = table[0].config;
    if(columnSelection && $.tablesorter.hasWidget( table, 'columnSelector')) {
        state.columnSelection = config.selector.states.map((e,i) => e ? i : false).filter(e => e !== false);
    }
    if(filters && $.tablesorter.hasWidget( table, 'filter')) {
        state.filters = $.tablesorter.getFilters(table);
    }
    if(sortList) {
        state.sortList = config.sortList;
    }
    return state
}

#17 Updated by Marc Egger about 1 month ago

Todo: Implement backend in qfq/extension/Source/api/tablesorter.php

"qfq/extension/Source/api/tablesorter.php" ist schon erstellt

Mockup Frontend: qfq/mockup/tablesorter.php (zeilen 50-53 wichtig!)
Mockup Backend: qfq/mockup/api/tablesorter.php

#18 Updated by Marc Egger about 1 month ago

  • Due date changed from 09.05.2019 to 23.05.2019

#19 Updated by Marc Egger 11 days ago

  • Assignee changed from Marc Egger to Carsten Rose

#20 Updated by Carsten Rose 5 days ago

  • Target version changed from 19.6.3 to CodingDays2019

#21 Updated by Carsten Rose 5 days ago

  • Target version changed from CodingDays2019 to QFQCD19 - Wichtig

#22 Updated by Carsten Rose 5 days ago

  • Has duplicate Feature #8172: Report: Spalten dynamisch ein/ausblenden und filterbar machen added

#23 Updated by Carsten Rose 3 days ago

  • Status changed from New to In Progress

#24 Updated by Carsten Rose 1 day ago

  • Status changed from In Progress to Closed
  • Target version changed from QFQCD19 - Wichtig to 19.6.3

Also available in: Atom PDF