DataTables logo DataTables

via Ad Packs

Frequently Asked Questions

DataTables is a complex piece of software and undoubtedly questions will arise from it's use. Some of these questions have already been posed and answered, and most common of which are shown here.

Getting help

Q. I have a question - how can I get help?
A. The best place to get help for DataTables is on this site. There is extensive documentation, examples, these FAQs and the forum for help. If you can't find the answer to your question on the site already, please post it in the forum. When posting a question about an exisiting table, please use the DataTables debugger to provide information about the table to assist in getting an answer.

Q. I need to get an answer to this question as soon as possible!
A. Post your question in the forum as normal, and then use the support page to purchase a support package for DataTables. Purchasing support ensures you will receive assistance with the problem you are having, and also helps support the DataTables project as a whole.

Q. How quickly can I expect a reply to my forum post?
A. The best way to ensure that you get a reply to your question is to purchase a support option. Response times will of course vary, but one will come normally within a day, but it can sometimes take longer (for example if people are away on holiday or have other commitments etc). If this is the case please don't be offended!

Licensing

Q. DataTables is great! How much is it?
A. DataTables is free, open source software that you can download and use for whatever purpose you wish, on any and as many sites you want. It is free for you to use! DataTables is available under two licenses: GPL v2 license or a BSD (3-point) license, with which you must comply (to do this, basically keep the copyright notices in the software).

Q. Which license applies to DataTables?
A. You can pick which of the two available licenses you wish to use DataTables under - pick whichever one suits your project.

Q. Really - its free, even for commercial sites?!
A. Yes! I'm very proud of what has been achieved with DataTables and the fantastic community that has helped it to get to where it is today, and I'm delighted to make it available as open source. Obviously if you benefit from DataTables then any reciprocation is very welcome, be it as a plug-in for DataTables, a donation to future development or a blog post saying you enjoy using DataTables.

Q. We can't use GPLv2 or BSD (3-point) licensed software. What do we do?
A. In the rare case that you can't use DataTables under either of the available licenses, please get in touch to discuss alternative licensing arrangements.

Development FAQs

Q. This is great software - how can contribute?

  • Write about DataTables on your blog and spread the word!
  • Create plug-ins for DataTables which can be show-cased on this site.
  • Answer support questions in the forums.
  • Contribute patches to any bugs you find - test for bugs.
  • Make a donation!

Q. Can I pay for integration support?
A. Yes! There are support packages for DataTables integration available.

Q. I have created a plug-in - how can I share it with everyone else?
A. Please send it to me direct, or post it in the forum.

Q. I think I have found a bug - how do I report it?
A. Please post your bug, along with as much information as possible for how to recreate it, in the forum.

Q. You use Hungarian notation - why?!?
A. When I wrote the first version of DataTables, the company I was working for then had strict coding standards that required the use of Hungarian notation, so I was "trained" in its use, hence why it is present. DataTables 1.10 will favour camel-case (Hungarian notation will still be supported for backwards compatibility, but camel-case will be the documented interface).

Most common FAQs

Q. My events don't work on the second page (events in general)
A. When attaching events to cells in a table controlled by DataTables, you need to be careful how it is done. Because DataTables removes nodes from the DOM, event's might not be applied. To over come this, is quite simple, as shown in these examples: pre-initialisation, post-initialisation. $().on() delegated events can also help. Finally you use my Visual Event bookmarklet to help debug event issues.

Q. I get a JSON parsing error
A. This is due to incorrect JSON data being passed back from the server. Please test your JSON return with JSON Lint before posting in the forum (the return can be viewed by using Firebug, or the like).

Q. "Requested unknown parameter" error
A. When DataTables requests a property that is not present in the data source for the table, you get this error. It can be caused by specifying an incorrect number of columns, missing parameters and colspan / rowspan in the body. If these points don't help address the issue, please use the DataTables debugger and post a question in the forum.

Q. "Requested unknown parameter" error when using fnRender
A. The fnRender function is passed in two parameters - an object with details about the cell, and the value of the cell. Often fnRender is used to create the value, but DataTables still needs a default value to pass into the function or an error is given. For this the sDefaultContent parameter can be used and simply set to be an empty string.

Q. I get a Javascript error in IE, but not in Firefox, Chrome etc.
A. The majority of the time, this is caused by a 'floating' comma at the end of an array. IE will throw a warning for this, other will delete it.

Q. I append a row to the table using DOM/jQuery, but it is removed on redraw.
A. The issue here is that DataTables doesn't "know" about your manipulation of the DOM structure - i.e. it doesn't know that you've added a new row, and when it does a redraw it will remove the unknown row. To add, edit or delete information from a DataTable you must use the DataTables API (specifically the fnAddData, fnUpdate and fnDeleteRow methods - plug-ins are also available to provide additional options).

General initialisation

Q. DataTables is running slow. How can I speed it up?
A. There are several ways in which you can speed up DataTables. The method you are using for loading the data will typically have the most significant impact on performance.

  • Client-side processing - DOM sourced data: ~5'000 rows. Speed options: bSortClasses
  • Client-side processing - Ajax sourced data: ~50'000 rows. Speed options: bDeferRender
  • Server-side processing: millions of rows.
Note that older browsers such as IE6/7 might have lower numbers than those given above. Additionally, if you are using Firefox, turn off Firebug as this can have a negative impact on performance.

Q. My table isn't working!?
A. Have you got a <thead> and <tbody> defined as DataTables requires (basic usage)? Is your HTML valid (W3C validator)? Are you seeing any Javascript errors?

Q. My styles aren't showing up / my table isn't styled.
A. Have you included the demo CSS for DataTables on your page (and got the paths correct!)? As a side-note I would strongly encourage customisation of the DataTables demo CSS.

Q. How can I move the table controls?
A. You can move the elements that DataTables puts around the table by using the sDom initialisation parameter.

Server-side processing

Q. Its not working... (stuck on processing)
A. This is usually down to incorrect JSON data being passed back from the server. Please test your JSON return with JSON Lint before posting in the forum.

Q. Its still not working...
A. The next most common reason for server-side processing not working is the sEcho variable not being returned as it was set in the request. DataTables uses sEcho to keep a draw count, so this is an important parameter. See server-side usage.

Q. Pagination is not enabled, or the information text shows the wrong data set count
A. This is likely to be caused by the incorrect use of iTotalDisplayRecords. iTotalDisplayRecords is the total number of records in the data set after filtering - not just the data array length (which DataTables can do itself!). So if you have no filtering iTotalDisplayRecords should be exactly the same as iTotalRecords.

Q. My events aren't being applied
A. What happens is that for each draw, DataTables will create the required display nodes (TR, TD etc), so old events are lost. You can either use $.live, or fnDrawCallback to re-add the events. You can also use my Visual Event bookmarklet to help debug event issues.