Running plugin if datatables exists

Running plugin if datatables exists

markjomarkjo Posts: 66Questions: 0Answers: 0
edited September 2012 in General
I add Datatables plugins inside my js files like this:
[code]$.fn.dataTableExt.oSort;[/code]
Sometimes I don't include datatables.js files in that pages.
But in that case I get this error :
[code]Uncaught TypeError: Cannot read property 'oSort' of undefined [/code]
How can I make this plugin loaded if datatables is active?

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    [code]
    if ( $.fn.dataTable ) {
    ... plug-in code
    }
    [/code]

    Allan
This discussion has been closed.