hello friends
I am using the hooks.py app_include_js to include javascript libraries to use them with several doctypes and that works fine, but this also produce bugs in the ERPNext functionality.
so how to avoid this conflicts with other libraries, maybe using RequireJS ?
sure
inside hooks.py i do
app_include_css = [“/assets/addons/css/elevateZoom.js”]
for example this js library it work fine in a doctype with HTML docfield with image element like this:
$(‘#myImg ’).elevateZoom();
but sometimes when i open other doctypes in different module i can see the zoom dialog bugged
is there anyway to include js files inside the targeted doctype only ?
JoEz
April 2, 2017, 10:30am
4
try include into doctype.js file if it is a external app doctype …or add a custom script for the desired doctype.
2 Likes
snv
April 2, 2017, 10:30am
5
do app_include_js
not app_include_css
1 Like
JoEz, is this mean that i have to edit the core doctype.js or create on inside my custom app and if so in which folder should be placed in?
Sagar_Vore, sorry its js really but i wrote it wrong in this topic
snv
April 2, 2017, 11:03am
7
Since it’s core, I recommend to copy all content of script and paste it into “Custom Script” and select relevant doctype.
1 Like
i think this can be solution How Can i add app_include_js for Single DocType?
but unlike rmehta posted, this method require second argument ‘callback’. im not sure how to impalement but i will check it.
snv
April 2, 2017, 12:42pm
9
2 Likes
thanks @Sagar_Vora just like what i want, including scripts in single doctype
1 Like
JoEz
April 2, 2017, 8:59pm
11
I’m not getting urtis point …i’m not saying to hack core code (doctype.js)…but to add you code to yourdoctype.js …or put it in custom scripts …