on 'select' event fires when anything in my Datatables is clicked, not just my row
on 'select' event fires when anything in my Datatables is clicked, not just my row
kdhunt2000
Posts: 8Questions: 1Answers: 0
in Select
I have a table with select 'single' enabled. In other tables it seems to work fine but for some reason when I click on any element in my datatables, i.e. column headers, length drop down, pagination buttons, my select event is fired and it even says its of type "row". I cannot figure out how to make the table not fire on anything other than a valid row click (not including column headers).
This discussion has been closed.
Replies
I cant seem to replicate it..
http://live.datatables.net/jeguruse/1/edit?js,output
The top will update the time and type whenever something is selected, when I click on column headers, length, etc, it doesnt change..
So if you can get us to replicate it, I can help, but if not, it seems to be an issue with your script specifically perhaps
I'm not too sure how to give you an example as I believe it has to do with serverside processing. When I enable that, that is when the problem manifests. When I disable it is when it seems to go away. In terms of providing an example I'm not sure how I could best go about doing that.
If you can't give us a link to your page, you would need to recreate a test case - you could use this as the basis for it: http://live.datatables.net/lorewiyo/1/edit .
Allan
Why doesn't this even work for selecting rows?
http://live.datatables.net/pubahuxi/1/edit?js,output
http://live.datatables.net/pubahuxi/2/
The JS files that were automatically included when you added the libraries, need to be below the core DataTables jQuery files.
Ive noticed it does that, that may be a bug, it should insert the libraries after the jquery.dataTables.js file.
@allan, is this something you might be able to address? I know its an issue and so I just move it lower every time, but some people dont realize that (Case in point ^ )
So I have no idea why I cannot recreate this using the live.datatables interface. However I can confirm that my system breaks when I am using serverside processing. For whatever reason ever if I switch "serverSide": to false it does not experience this weird behavior of throwing a select event on non-row element clicks. But as soon as I enable serverSide Processing everything is thrown out of whack again and it begins registering select events on pagination/length menu clicks, with type 'row'.
I will try using the latest and great Datatables and seeing if that affects it, but I believe I am already up to date. This is very odd behavior.
I apologize for this thread, I grabbed a new copy of datatables with select bundled in and the problem seems to have vanished. Bizarre but that was on me, I should have tried that first.
Weird, glad you gotbit fixed