ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

How to Add DataTable javascript library in custom script



How to include DataTable library in custom script.

// include libraries
$.getScript(“”, function() {
$.getScript(“”, function() {


I also wanted to do the same but $.getScript wasn’t importing the functions and I get only one error ie datatable is not a function.
Tried with static data and still the same issue. I can’t go to backend coz thats the only limitation I have. Although on testing instance i added those datatable’s js and css files and then ran the command bench build and then it worked but in real, I need to do the same but with custom script only.



Try using frappe.require, then accessing DataTable in the callback:

    "/assets/frappe/js/lib/frappe-datatable.js"], function(){

        var dt = new DataTable(...);



what if i want to use external libraries


Hi @jhk
giving below errors

IOError: [Errno 2] No such file or directory: u’./assets/frappe/css/frappe-datatable.css’


Are you on the latest develop? If you’re on master or an older version of develop datatable might not be there. Check in your frappe’s package.json file and see if ‘frappe-datatable’ is listed as a dependency


Yes, i am on the latest version(10.1.47).


Did you figure this out - please share some example code, thanks


For an overview of what’s going on re dependencies and execution order this may help