surveyjs / survey-analytics

Customizable JavaScript library to create interactive survey data dashboards and facilitate survey results analysis for your end-users.
https://surveyjs.io/dashboard/examples/plain-data
Other
99 stars 52 forks source link

Table View: Implement an API to disable sorting #442

Closed JaneSjs closed 4 months ago

JaneSjs commented 5 months ago

IMPLEMENTED

Since SurveyJS Dashboard v1.11.4, the Table View allows you to disable sorting for all columns by setting the allowSorting property to false:

import { Tabulator } from "survey-analytics/survey.analytics.tabulator";

const table = new Tabulator(survey, data, {
  allowSorting: false
});

https://github.com/surveyjs/survey-analytics/blob/b387d322bd03808cc4bec1e5a96e7d366c12cc34/src/tables/tabulator.ts#L332

https://plnkr.co/edit/fDbfT8Pfbp7s50R8

According to the Tabulator docs, the headerSort: false setting should disable the sorting option within column headers. However, I see that the sorting arrows remain regardless of the headerSort option. I also tried to disable it as follows:

vizPanel.tabulatorTables.getColumns().forEach((column, index) => {
                const questionName = column.getField();        
                if(!!questionName){
                    vizPanel.tabulatorTables.updateColumnDefinition(questionName, {
                        headerSort: false,
                    });
                }
 });