Why there is a difference between dataTable() and DataTable()?

Why there is a difference between dataTable() and DataTable()?

LuizHoutLuizHout Posts: 3Questions: 1Answers: 0

This has confused me, it was no clear that with DataTable() i had acces to functions and variables and w/ dataTable() i had not access to several functions.

There are some issue on my side and both should work w/ no difference? If not, Why make a such delicate difference? Add a parameter, so it make that difference, is much more "visible".

This question has accepted answers - jump to:

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    Answer ✓

    http://datatables.net/faqs/index

    See the second of the "Most Common FAQ's".

  • LuizHoutLuizHout Posts: 3Questions: 1Answers: 0
    edited May 2015

    Thanks. The behavior was described on faq.
    However, it seems odd to create a diference of return type from UpperCase and lowerCase calls.

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Answer ✓

    I should write a blog post about it sometime. Basically $().dataTable() was the old style (v1.0+) and does the standard jQuery thing of returning a jQuery object for chaining.

    $().DataTable() returns a DataTables API instance - U used a capital D as you are creating a new API instance and a capital for an instance constructor is common programming styling across the majority of languages (albeit not a requirement).

    I figured that was better than using $().dataTableApi() or similar. I might have been wrong :-)

    Allan

  • LuizHoutLuizHout Posts: 3Questions: 1Answers: 0

    Thanks for the answer man. Legacy purpose. That explains completely. :)

    By the way. Your plugin is awesome and solve perfectly all my needs.

    I suggest only. Update the examples in your site to use the DataTable(). I saw that several alredy use the uppercase function. But that was when a got stuck. (and of course. missing the faq).

    Anyway, thanks for the awesome plugin and for the promptly response.

This discussion has been closed.