question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: hiding a column by which the table is sorted breaks `multi column sorting`

See original GitHub issue

please use the following example:

  1. remove the .txt suffix,
  2. put it in the examples folder
  3. order by % complete, start.
  4. hide start column.
  5. add finish to sort

voila! check your browser’s console, and you will see the message! the behavior is visualized in the following GIF.

the reason behind this behavior is that slick-grid changes the entire column-set each time a column is set to be hidden; which causes the getColumnIndex function to return null, as the hidden column is not on the list of columns; obviously!

the solution is more complicated as far as I can tell! because many plugins and existing codes depend on the current implementation of the getColumns and getColumnIndex functions, it’s not easy to add a property - for example, called visible ` to the column definition in order to control column visibility. hiding or showing columns shouldn’t be a matter or setting a new column-set, but rather a matter of changing their visibility and redrawing the whole table!

multi-sort-issue

example-multi-column-sort.html-broken.txt

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
arashdalircommented, Oct 28, 2020

@ghiscoding I took a more accurate look at how the setupColumnSort function, in which this error occurs, works.

unfortunately, the functions getColumns and getColumnIndex do not use the same variable; therefore, the allColumns will not resolve this issue directly. I believe, in order to resolve this specific issue I will need to define a getColumnById(id, useOnlyVisibleColumns) function. will post my solution as soon as I am finished…

0reactions
ghiscodingcommented, Oct 28, 2020

You are most welcome to create a PR to add the allColumns, the GridMenu also uses the same code as ColumnPicker to show all columns, in my libs I a copy of allColumns on ColumnPicker, Grid, on Filtering and Sorting and that seems to be it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sorting breaks when trying to use columns.orderData with order
In my datatable, I have two columns which I want to do a multi-column default sort. However, the columns I want to sort...
Read more >
Sort not working the way its supposed to. - Microsoft Community
If it looks like the data did not sort properly, refer to the following list of possible solutions: • Make sure no hidden...
Read more >
Table Viz - Sorting by multiple columns no longer ... - GitHub
Explore a table (or find one in a dashboard) · Click on the header of an alphanumeric column to sort by that column...
Read more >
How to Sort in Excel Rows or Columns Avoid Sort Problems
Easy steps to sort multiple columns, avoid problems. Sort in custom ... You might need to unhide rows or columns, to find the...
Read more >
Fixing Sort Problems | Sorting Data in Microsoft Excel 2016
Make sure no hidden rows or columns exist. · Use a single row for headers. · If the headers were sorted into the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found