Where to add responsive value?
Where to add responsive value?
gusdelfI@student.gu.se
Posts: 5Questions: 1Answers: 0
I have an existing DT system, I've downloaded the new CSS and JS responsive files and i'm now wondering where to add the responsive: true value to the JS scripts.
I assumed it would be table.home.js file
var table = $('#home').DataTable( {
ajax: 'php/table.home.php',
columns: [
{
"data": "full_name"
},
{
"data": "level"
},
{
"data": "id"
},
{
"data": "email_"
},
{
"data": "assesser"
}
],
rowReorder: {
selector: 'td:nth-child(2)'
},
select: true,
responsive: true,
lengthChange: false
} );
Like such, this seems to make no difference to the tables tho?
Thanks you!
This discussion has been closed.
Answers
Thats the correct place to enable responsive. Make sure you are loading the responsive JS and CSS, that there are no errors in your browser's console and that they are loaded in the correct order. You can use the Download Builder to verify the order.
Otherwise we will need a link to your page or a test case showing the issue to help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Thanks for the reply Kevin, I'l link to a live site later once I remove the login requirement.
This is how i'm calling the files in the home.php page,
'''
'''
Is that the correct order?
It would be worth running the macro from the debugger - this will let you know if libraries are missing.
Cheers,
Colin
looks like you are adding Responsive twice; once in line 8 and the other in line 12. Click on the link in line 8 and you will see all the libraries being loaded. I suspect loading Responsive twice could be causing the problem.
You should consider running the Download Builder again to generate a CDN with the latest versions.
Kevin
Colin
I've used the debugger and no warning are appearing. The link is https://debug.datatables.net/ifunuw
It's telling me my version are outdated even after uploading the latest file downloaded from the download builder.
Kthorngren
Done, but no fix.
It seems to work if I make my window very small on my desktop, but not on my mobile or on google mobile friendly tester site. Which seems a bit odd?
I think we'd need a link to a page showing the issue I'm afraid.
The download builder is a version behind the current releases as they are in fact identical - there was a bump release because of a packaging error for npm.
Allan
I've removed the front end you should be able to find the link here http://nuigmc.com/registeredclimbers/home.php
Hi @gusdelfI@student.gu.se ,
I'd say it's working as expected. Because the table fits the entire page width, it does need to shrink significantly before the responsiveness kicks in. Also, the text first wraps, again reducing the need for responsiveness - this can be disabled by setting the class
nowrap
on the table.Cheers,
Colin
Cheers Colin,
Glad to know it's working so! Thanks for the support