Casing problem with ajax and dataTables name under 1.10 beta 2
Casing problem with ajax and dataTables name under 1.10 beta 2
AdeDerby
Posts: 3Questions: 0Answers: 0
Hi,
I have found a problem with 1.10 beta 2 (only been using this so not sure if it exists under other versions)
First time posting to a forum so not sure if I am doing this right either.
if you use the following code:
[code]
var table = $('#example').dataTable( {
ajax: "data.json"
} );
[/code]
The returned object does has the .ajax part missing. However if you use:
[code]
var table = $('#example').DataTable( {
ajax: "data.json"
} );
[/code]
It does. All the difference is the use of .dataTable or .DataTable
This does not seem to be explained any where in the documentation (though I could have missed it).
I hope this makes sense!
I have found a problem with 1.10 beta 2 (only been using this so not sure if it exists under other versions)
First time posting to a forum so not sure if I am doing this right either.
if you use the following code:
[code]
var table = $('#example').dataTable( {
ajax: "data.json"
} );
[/code]
The returned object does has the .ajax part missing. However if you use:
[code]
var table = $('#example').DataTable( {
ajax: "data.json"
} );
[/code]
It does. All the difference is the use of .dataTable or .DataTable
This does not seem to be explained any where in the documentation (though I could have missed it).
I hope this makes sense!
This discussion has been closed.
Replies
> It is important to note the difference between $( selector ).DataTable() and $( selector ).dataTable(). The former returns a DataTables API instance, while the latter returns a jQuery object.
Among others.
What you are seeing is not an error - it is intentional. Perhaps I got it wrong doing it that way, but I quite liked the elegance of it - the upper case is more 'constructor' like following the general software trend for classes, while the lowercase is jQuery like - and thus it returns a jQuery object.
Allan
It could be worth putting a note on that section as it is easy to miss the letter change.
Thanks for clearing it up.
Allan