Select.selector and ColReorder

Select.selector and ColReorder

Tester2017Tester2017 Posts: 145Questions: 23Answers: 17
edited April 2018 in Select

Be aware that if you use select.selector and ColReorder you might get some strange behavior if you are using it in the same way as me.

In every table I have two "special" columns; the 1st with no data, which will hold eventually the child-row-button and the 2nd with will have a select-checkbox for selecting a row.

An example:

select: {
    style:      `os`,
    selector:   `td:nth-child(2)`
},
...
columns:
[
    {data: null, defaultContent: ``, searchable: false, orderable: false},

    {data: null, defaultContent: ``, className:`select-checkbox`, searchable: false, orderable: false},
...

But what if you have enabled ColReorder at the same time?

Well then is it possible to drag the 2nd column to the 1st position. The select-checkbox will appear in the 1st column, but the selecting mechanism still works only via the 2nd column. The dragging might be a little bit confusing here, because the select-check-box will now appear in the 1st column, and the child-row-button will stay also in the 1st column. This is normal behavior, but it looks strange, you change column 1 and 2, but all the content appears in the 1st one.

This happened to me by accident, and I lost more than an hour to understand what happened as I am also using "state saving". So every time when I opened my table with the dragged select-checkbox I thought that I had some error in the table definition, but I couldn't find anything, until the moment I decided to clean the local storage, and wow, everything was back to normal.

Conclusion: Everything is working as expected, but you might get confused...... Although it should be nice if the select-selector could be updated after a dragging event.

Example images.

Before dragging:

After dragging:

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.