BUG: hiding a column by which the table is sorted breaks `multi column sorting`
See original GitHub issueIssue Description
please use the following example:
- remove the
.txt
suffix, - put it in the
examples
folder - order by
% complete
,start
. - hide
start
column. - 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!
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
@ghiscoding I took a more accurate look at how the
setupColumnSort
function, in which this error occurs, works.unfortunately, the functions
getColumns
andgetColumnIndex
do not use the same variable; therefore, theallColumns
will not resolve this issue directly. I believe, in order to resolve this specific issue I will need to define agetColumnById(id, useOnlyVisibleColumns)
function. will post my solution as soon as I am finished…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 ofallColumns
on ColumnPicker, Grid, on Filtering and Sorting and that seems to be it