Trying basic table example in html but table disappears
Trying basic table example in html but table disappears
GabeTheGreat
Posts: 7Questions: 1Answers: 0
Hi all,
So I have an html page with a table in the header. Further down I'm using the example presented in the datatable main page. When I load the page, my table displays for about half a second, then it disappears... everything else displays ok... can anybody help? here's my code for that particular section...
<!-- Start of loads page -->
<div data-role="page" id="loads">
<div data-role="header">
<a href="#main" data-transition="slide" data-direction="reverse" class="ui-btn"><</a>
<h1>Loads</h1>
</div><!-- /header -->
<div role="main" class="ui-content">
<p>This Text is above the table...</p>
<p>
<script type="text/javascript">
$(document).ready(function() {
$('#table-loads').DataTable();
} );
</script></p>
<p>This is below the table...</p>
</div><!-- /content -->
<div data-role="footer" data-position="fixed">
<h4></h4>
</div><!-- /footer -->
</div><!-- /page -->
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Its hard to say why the table disappears without actually seeing the page. There must something else on your page that is hiding or removing the table. Can you post a link to your page or a test case replicating the problem so we can help debug?
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Thank you for your reply. Heres the full html code....
It doesn't look like you are loading jquery.js. See the Dependencies section of the Install Manual.
Kevin
its on line 9 of my code …
do I need to add it into another section?
ok, I downloaded jquery-3.4.1-min.js and put it in my js folder. Then I added this between lines 9 and 10 of my original code...
<script src="js/jquery-3.4.1.min.js"></script>
still no change, it still disappears... thanks for the responses so far. I appreciate your help.
Are you seeing console errors? Can you provide a link to the page, please?
Colin
ok I uploaded it to sugarfreergv.com... still does the same thing ugh...
The problem is not with Datatables but something that you are doing with the page. Could be the
jquery.mobile-1.4.5.js
library. When I inspect the page I see this:It shows that the
script
tag containing the Datatable is set todisplay:none
. Some code on your page is hiding the Datatable. Your code without thejquery.mobile-1.4.5.js
works here:http://live.datatables.net/duyuqoqe/1/edit
Yes, the layout and page flow is not the same but shows Datatables is working. You will want to use the jQuery Mobile support for help with setting up the page to work the way you want.
Also you only want to load jquery.js once and before all of the other libraries that require it. Sorry I missed it in your first post.
Kevin
Success! thx for your help.... I added the libraries from the DataTables folder you posted and it finally worked. Thx again