Column Search (Select Inputs) doesn't work with scrollX: true
Column Search (Select Inputs) doesn't work with scrollX: true
Mert1296
Posts: 43Questions: 7Answers: 0
Hi Everyone,
I have an issue with my column search via select Inputs. When I enable scrollX, my search fields are under my Header. but I really don't know why. can you guys help me out?
Here is a test case: http://live.datatables.net/ruyezofa/4/edit
Cheeres,
Mert
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @Mert1296 ,
You need to place those dropdowns with
table().header()
- this thread has the same issue and the fix is at the end.Cheers,
Colin
Hi @Colin ,
Thanks for your help! I tried it but it didn't work.. Can you help me out please?
Cheeres,
Mert
So I tried to code an own function for the select Inputs. The issue here is, that the select fields are cut off from the tbody. When I set the overflow Y of my header to visible, I can scroll in my thead to see my values in the option fields but I want it without the Scrolling in my thead..
here is my function:
I don't know why but I can't Highlight the code sorry for that
Hi @Mert1296 ,
For code highlighting you need a tripe quote - I modified that above.
I took your last example and got it working, see here. Hope that all does the trick on your live system, shout if not,
Cheers,
Colin
Hi Colin, thanks for your help!
I made it a Little bit different but this one works too and without a 2nd Header: http://live.datatables.net/ruyezofa/12/edit
Now what I have to do is to make the select boxes multiple (that I can click on more than one Options). But I can't find something in the forums.. do you now how it works?
Cheeres,
Mert
The problem with having the drop down in a single header is clicking it could cause that column to also sort.
See if this thread helps for multi-select:
https://datatables.net/forums/discussion/49676/multi-select-columns#latest
Kevin
Hi @Mert1296 ,
In my last example, that had two selects - so you could copy that code across. It just needs the class on the column header.
By the way, it is best to have the second header, otherwise clicking on the select will change the ordering.
Cheers,
Colin
Yes I tried it with the select2 plugin but it didn't work.. maybe bc I'm trying to put the select boxes into my Header?
What happened?
Kevin
Just nothing. can't even see my table..
Cheeres,
Mert
But in the test case it works: http://live.datatables.net/ruyezofa/13/edit
Look for errors in your browser's console.
Kevin
"The object does not support the "multipleSelect" property or method."
But I think thats an other plugin
So with my function with the multiSelect-PlugIn above it works with the multiselection. but like I said: the dropdown-menu is cut off and I have to set the OverflowY of my thead to visible. Problem here is that I have to scroll my thead for seeing all values in my Dropdown list
I changed my example to move the select2 search input from the footer to the 2nd header. Sith
scrollX: true
it seems to work fine.http://live.datatables.net/liheluka/1/edit
I guess the next step is to provide a test case showing your issues so we can help.
Kevin
Okay, thank you for your help!
When I'm using my Website, I can't see my table when I'm using the select2 PlugIn but when I copy my whole DataTable into the test case with using the select2 it works.
I really don't know why.. The console also doesn't show me Errors
Mert
Its probably a CSS conflict. Are you using a styling Framework? If so I would start there and add that to your test case. Then keep adding components from your webpage to the test case until you find the conflict.
Kevin
Yes I'm using Bootstrap 3 - only Bootstrap but when I'm removing the CSS file I have the same issue..
And now my console shows me this error: "Syntax error, unrecognized expression: #"
Not sure what is causing the syntax error. I updated my example to use Bootstrap 3.
http://live.datatables.net/liheluka/4/edit
Still seems to work correctly. Do you have other Datatables extensions like FixedColumns or FixedHeader?
Kevin
I have Buttons, select, colReorder, colVis.
Again my suggestion would be to update my example with what you have to try replicating the issue. This way when you replicate the problem you have a test case for us to look at.
Are you putting your search inputs in the second header like my examples?
Kevin
Okay here is a testcase with all imports and my datatables without the columndefs:
http://live.datatables.net/liheluka/5/edit
The test case wasn't running. Found this error in the browser's console:
Commented out those lines then this error:
Noticed you had a typo with this:
I noticed this error when leaving the select2 input. Doesn't seem to cause any issues. I tried it with my BS example and it does the same until I remove scrollX. Removing scrollX from your example doesn't alleviate the error.
Looks like the select2 inputs are working. Are they for you?
Can you post a link to your page so we can see the problem?
Kevin