Announcement
Collapse
No announcement yet.
Extend Views Setup Handlers add (entity-manager/record/edit)
Collapse
X
-
Got it to work now, cleared cache from UI and cache of browser and it worked
Thanks Yuri appreciate your time
-
If the JS file is cached by the browser, open it in a tab and Ctrl + F5.
- Likes 1
Leave a comment:
-
You should be able to see your script in the html source. Ctrl + U in the browser.
- Likes 1
Leave a comment:
-
Yes,
It is enabled (i did clear cache both from UI and also through CLI)
here is my app > client.json
PHP Code:{
"scriptList": [
"__APPEND__",
"client/custom/modules/{@nameHyphen}/lib/init.js",
"client/custom/modules/plus-extension/src/plus-script.js"
],
"developerModeScriptList": [
"__APPEND__",
"client/custom/modules/plus-extension/src/plus-script.js"
]
}
and my plus-script.js under src folder in my files / client/custom/modules/plus-extension/src/plus-script.js
PHP Code:require(['views/admin/entity-manager/record/index'], View => {
const defaultSetup = View.prototype.setup;
View.prototype.setup = function () {
defaultSetup.call(this);
console.log('custom setup', this.name);
};
});
That is weird still not working, even if i console log outside the method nothing shows in the console.
Leave a comment:
-
Developer mode enabled? I tried, it worked for me in the developer mode. Clearing cache required.
Code:{ "developerModeScriptList": [ "__APPEND__", "client/custom/src/test.js" ] }
Leave a comment:
-
Added to both scriptList and developerModeScriptList ?
Leave a comment:
-
I understand, Thanks for your time and explanation, so based on this conversation here https://github.com/espocrm/espocrm/i...ent-1801495815 and also https://forum.espocrm.com/forum/deve...522#post100522 i am trying this code below to monkey patch but didn't succeed. is there any related article/conversation about how to get it up working properly. Thanks
PHP Code:require(['views/admin/entity-manager/record/edit'], View => {
const defaultSetup = View.prototype.setup;
View.prototype.setup = function () {
defaultSetup.call(this);
console.log('custom setup', this.name);
};
});
Because i am using es6 i also tried below
PHP Code:import EntityManagerRecordEditView from 'views/admin/entity-manager/record/edit';
const defaultSetup = EntityManagerRecordEditView.prototype.setup;
EntityManagerRecordEditView.prototype.setup = function () {
// Call the original setup method
defaultSetup.call(this);
// Your custom logic
console.log('Custom setup for Entity Manager Index View:', this.name);
};
export default EntityManagerRecordEditView;
Any help would be appreciated and i know how much busy you areLast edited by rabii; 09-27-2024, 12:44 PM.
Leave a comment:
Leave a comment: