Newby Question concerning jquery code for options
Newby Question concerning jquery code for options
Thanks to all who created, maintain and provide assistance for DataTables. It is a wonderful program and I was able to get it working. After several hours though I still cannot understand how to code options. I am new to Java Script and jQuery and I think that is the problem. I initialized DataTables with jQuery and it works fine. I used the following code:
$(document).ready( function () { $('#mytable').DataTable(); } );Where I am getting confused is in setting options like paging. The sample code given in DataTables is:
$('#example').DataTable( {
paging: false
} );
I think I should bracket the code with tags?
Replace the #example with the name of my table which is #mytable ?
And then place it in my HTML header next to the initializing code?
Or should I try to incorporate the code into the initialization code?
I tried all but nothing seems to work.
Any assistance is appreciated.
Thanks again for a wonderful program.
Best Regards,
Tim
This question has an accepted answers - jump to answer
Answers
The examples don't show how to layout a web page. It is assumed that the developer has this basic knowledge.
Yes. Maybe this tutorial will help.
Replace
#example
with a selector, usually thetable
id
, that finds one or moretable
elements that are to be Datatables.See this simple example with your code snippet, look in the HTML tab at the bottom for the Javascript.
https://live.datatables.net/noqezabu/1/edit
Kevin
Thank you very much for your informative and helpful answer. The tutorial was especially helpful to understanding why the script needs to be placed at the end of the HTML file. Your example was very helpful too. Thanks again!
Tim