Adding Custom JavaScript
Collapse
X
-
Thank you so much for directing me into the right way, but i did it a little bit my way. Anyway big up and thanks! -
client/src/views/fields/address.js
A straightforward way.
method:
PHP Code:setup: function () {
Dep.prototype.setup.call(this);
this.wait(true);
// here you load your lib asynchronically
this.wait(false); // call this asynchronically after your lib loaded
},
Disable cache in Administration Settings for developing.Last edited by yuri; 06-27-2016, 11:07 AM.Leave a comment:
-
So if I need to include my library and custom js into address field, which class would it be?Leave a comment:
-
Writing code in templates won't work properly. It's SPA, not a simple web page.
You can write javascript only in classes. Which class to use depends on where you need to include your custom library.Leave a comment:
-
So, if I do that, it stops making my GET and POST requests with server-name/api/v1 prefix? Or am I doing something wrong? When I trying to do this
Code:
$('#address').suggestions{ serviceUrl:"www.example.com"; }
it making request GET server-name/api/v1/www.example.com.
Why??????????
Problem still here.
Why it making request adding site address with api path as prefix???Leave a comment:
-
Crm:Views.Dashlets.Abstract.Chart corresponds to 'client/modules/crm/views/src/dashlets/abtract/chart' file
But this definition style is dated.
Now we use:
crm:views/dashlets/abtract/chart => client/modules/crm/src/views/dashlets/abtract/chart
custom:views/dashlets/abtract/chart => client/custom/srcviews/dashlets/abtract/chart
Code:$('#address').suggestions{ serviceUrl:"www.example.com"; }
Why??????????Leave a comment:
-
Crm:Views.Dashlets.Abstract.Chart corresponds to 'client/modules/crm/views/src/dashlets/abtract/chart' file
But this definition style is dated.
Now we use:
crm:views/dashlets/abtract/chart => client/modules/crm/src/views/dashlets/abtract/chart
custom:views/dashlets/abtract/chart => client/custom/srcviews/dashlets/abtract/chartLeave a comment:
-
In what class? Class of added library? Excuse me, I'm junior developer, but i think that extended documentation on your product will be very helpful for the community.Leave a comment:
-
Hi
I think it's obvious if you ever encountered AMD.
Metadata app.jsLibs
"Flotr": {
"path": "client/lib/flotr2.min.js",
"exportsTo": "window",
"exportsAs": "Flotr"
}
Then in javascript class
PHP Code:Espo.define('Crm:Views.Dashlets.Abstract.Chart', ['Views.Dashlets.Abstract.Base', 'lib!Flotr'], function (Dep, Flotr) {
return Dep.extend({
});
});
It will load this js dynamically. exportsTo is where the lib exports its object. window.Flotr or $.summernote.Last edited by yuri; 10-24-2014, 01:37 PM.Leave a comment:
-
Adding Custom JavaScript
Hi Yuri,
What's the correct way of adding custom JS libraries to the CRM?
I edited jsLibs.json with my custom libraries but I don't know if I have to do something more.
Thanks
Leave a comment: