Hi, need help! I am trying but am unable to add jQ...
# suitecommerce
s
Hi, need help! I am trying but am unable to add jQuery DataTable library in my SuiteCommerce extension. I followed the developers.suitecommerce guide which adds MersenneTwister library to use it's random() method (Adding a Non-AMD Compatible Library to an Extension). The MersenneTwister > random() method is working correctly but when I try adding jQuery DataTable library, I always get error "*jQuery(...).DataTable is not a function*" in my .tpl. Is this the right way to add DataTable library (Adding a Non-AMD Compatible Library to an Extension) or I need to use different? Thanks
👀 1
h
Try to add JQUERY CDN or what ever you want into layout.on('beforeShowContent',function(){ ////place here CDN })
👍 2
s
Thanks Bro.. will check this
s
The library you're trying to add looks like it is an AMD-compatible jQuery library, which means you should try following the instructions in that section https://developers.suitecommerce.com/add-a-third-party-javascript-library-to-your-site.html#adding-an-amd-compatible-jquery-plugin-to-an-extension
👍 1
s
Thanks @Steve Goldberg, Yes you are right. DataTable is AMD-compatible library and working this way.