Multiple checkbox columns
Multiple checkbox columns
I'm trying to adapt your running example ( https://editor.datatables.net/examples/api/checkbox.html ) adding more checkbox columns.
I cannot make it work properly and i think the issue comes from the callback function that it's designed for an only checkbox columns at the last column of the table. It checks the field at the database but it doesn't keeps it checked on the table. Unchecking doesn't works when checking again. Buble editing does work.
Code is taken from the running example so i don't think it's useful to post it here again.
Could you give me some tips to follow on this?
Thank you in advance.
This question has an accepted answers - jump to answer
Answers
Have you updated the code to use different classes and event handlers for the other columns?
If you could show me your code I might be able to spot what is wrong.
Allan
Hi Allan , thanks for answering.
No i didn't do that ( will try them of course ) , tried many thinks in order to simplify code but as you'r telling me i think it would be more tricky than expected.
I put here the final .html generated ( i do it using php ) . You'll see lot of commented lines due to testing but tried even more things...forgive me if you see some nonsense things
Yes, that looks like it is the issue.
If we take this example and looking at the code displayed just below the table, to make another column with checkboxes you would have:
Allan
Thank you so much Allan ,
Sometimes we don't see the answer although we have it in front. I will test it when i got a bit of free time and give you feedback on results.
Hi ,
I finally made it work , following Allan instructions i could notice that it was wrong and diging on a conceptual mistake .As the html file is dynamically generated by a php script i was focusing too deep pretending i was treating the thread as an array problem when i was not really doing it.
I'll try and clean it of errors but i can now share my first approach on this , hope this can help others.
Again my thanks to you Allan for your fast and efficient help
Revised code and fixed some issues . It works properly now.
But i spotted a strange behaviour , if i select a row and then move to next results page it remains as selected unless i select another one on the next results page. it's there something wrong in my code?
Thanks for posting back - great to hear you've got it working now.
Allan
It fails when using Responsive Extension.
I've debugged it and i think it has to do with DTE DTE_Inline divs dynamically created when you click any checkbox placed on an expanded hidden columns.
I'll be digging on it .
Any ideas?
Its probably related to the selectors being used. Could you give me a link to a test page showing the issue so I can take a look?
Allan
I found a possible fix :
Using "Renderer" function .
Use of
js renderer: $.fn.dataTable.Responsive.renderer.tableAll()
shows all the columns as a nested table and works as expected.Using the function that only shows the hidden columns on a nested table fails .
I prefer using this second option . I'll keep digging into it and I'll give you feedback.
I'm not able to make it work...
I think it's an event listeners bubbling issue, could you guide me on this?
Just a guess, but I think
$(this).closest('tr')
will select the child row when using responsive, not the parent row that editor expects.Ugly workaround I used myself for this situation is something like this
Thanks so much HPB I'll test it when I'm on the laptop...and of course I'l give you feedback news.
HPB your approach doesn't work either. Thanks anyway