Christopher Christopher - 1 year ago 95
Javascript Question

DataTables initialization keywords different with official examples

I'm new to DataTables due to new requirements of a project. I've started to learn it, but I'm confused about the inconsistency between the official site examples and the real usages.

Specifically, I wonder why the name of the options when initialize datatables could be always different between the official examples and practical use. For example, in official guides, initializing table with static data is demonstrated as follow:

$('#example').DataTable( {
data: data
} );

However, after I realised this does not work. I searched in statckoverflow so I got the solution should be

"aaData": data

So, why they maintain the gap. Is this because of some issues like the namespace? Also, if they always different, how could I know the correct keywords of those options?

I know that this question might be stupid, but I failed to find the answer for many hours. Any help will be appreciated.

Answer Source

Hungarian notation aaData is used for jQuery DataTables 1.9. New camelCase naming convention data is used in jQuery DataTables 1.10+. Both are supported in jQuery DataTables 1.10+ to provide backward compatibility.

See Converting parameter names for 1.10 for more information.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download