How to remove a row containing a select2 dropdown?

How to remove a row containing a select2 dropdown?

kartofakartofa Posts: 2Questions: 1Answers: 0

Link to test case: https://live.datatables.net/xirimice/1/edit?html,js,output

Debugger code (debug.datatables.net): ikahot

Error messages shown:
16 tests complete. 1 problem was found:
Table ID: #exampleTable
Problem description: The table has scrolling enabled and the header and body parts of the table are misaligned. This is typically cased by the table being initialised when it is hidden. In this case, the table needs to have the columns.adjust() method called on it when the table is made visible. This example shows how that can be done with Bootstrap tabs.

Description of problem: When using a select2 inside the table it bricks the scrollability on row remove. In the example from above, a basic table with a select2 dropdowns, the 5th row supposedly deletes the last row (itself) if the value is changed (just the simplest example I could think of) and after that you can't scroll anymore and the above error shows up. (The rest of the table functions normally) Another thing I ran into while testing was when I had two similar boxes both inside and outside, the outside one will work without any problems, but with the inside this happens. (I placed another one bellow for you to test as well). Also tried the calling columns.adjust() as the error message suggested but it didn't help.

The way I'm using the select2 is I have a table with x rows. I create a new row with the select2. If the user selects anything that's in the other x rows it removes this new row and shows the user the already existing one.

I also tried destroying the select2 before removing the row but it didn't help. My guess is maybe I'm doing something incorrectly somewhere and hopefully somebody can point me to where that is and a solution?

This question has an accepted answers - jump to answer

Answers

Sign In or Register to comment.