How to add custom JS in admin Magento 2Magento 2 does not read my requirejs-config.jsMagento 2: can't use materialize.js on my custom moduleRequire Js Error: Mismatched anonymous define() module: function Magento 2Magento 2: Not Able to Login As A CustomerMagento 2 add custom validation ruleImportExport module: can't work custom file adapter in magento2?Magento2 Autoload errorMagento 2 override admin product-gallery.js file in custom moduleAdd popup on clicking custom button in product edit page in admin in magento 2.3How implement form in payment method
Why is there a large performance impact when looping over an array over 240 elements?
These were just lying around
When were the tantalum capacitors first used in computing?
Why I have higher ping to the VLAN interface than to other local interfaces
How to disable "Completion time:..." in SQL Server Messages window
Can a PC use the Levitate spell to avoid movement speed reduction from exhaustion?
Why is the result of ('b'+'a'+ + 'a' + 'a').toLowerCase() 'banana'?
On the Rømer experiments and the speed of light
Solution to German Tank Problem
What is the status of the F-1B engine development?
Can the government force you to change your license plate?
The cat ate your input again!
Does the Fireball spell damage objects?
Does fossil fuels use since 1990 account for half of all the fossil fuels used in history?
Plotting octahedron inside the sphere and sphere inside the cube
Generate Brainfuck for the numbers 1–255
How to reduce Sinas Chinam
Normalization constant of a planar wave
80's/90's superhero cartoon with a man on fire and a man who made ice runways like Frozone
Why does chown not work in RUN command in Docker?
How to describe accents?
Enigma between Collegues (Part1)
What ability do tools use?
Why does the standard fingering / strumming for a D maj chord leave out the 5th string?
How to add custom JS in admin Magento 2
Magento 2 does not read my requirejs-config.jsMagento 2: can't use materialize.js on my custom moduleRequire Js Error: Mismatched anonymous define() module: function Magento 2Magento 2: Not Able to Login As A CustomerMagento 2 add custom validation ruleImportExport module: can't work custom file adapter in magento2?Magento2 Autoload errorMagento 2 override admin product-gallery.js file in custom moduleAdd popup on clicking custom button in product edit page in admin in magento 2.3How implement form in payment method
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to add a custom js file in magento 2 in the admin but all I can see are sample on how to add in the frontend. I found some that shows how to add in admin but none works. Below are my code that I copied from some sources
//app/code/COMPANY/PRODUCT/view/adminhtml/requirejs-config.js
var config =
"map":
"*":
"generateMenu": "TCM_HeaderMenu/js/generateMenu"
and in the file located in app/code/COMPANY/PRODUCT/view/adminhtml/web/js/generateMenu.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
require([
'jquery',
'logger'
], function($, logger)
'use strict';
logger.log('inchoo.js is loaded!!');
//creating jquery widget
$.widget('generateMenu.js',
_create: function()
this.element.on('click', function(e)
logger.log("You click on element: " + e.target);
);
);
return $.generateMenu.js;
);
But it seems that this is not being called when I refresh the page.
Note: I'm trying to load the custom js in Catalog->category page in the admin panel
magento2 magento-2.1 magento2.3 requirejs
add a comment |
I'm trying to add a custom js file in magento 2 in the admin but all I can see are sample on how to add in the frontend. I found some that shows how to add in admin but none works. Below are my code that I copied from some sources
//app/code/COMPANY/PRODUCT/view/adminhtml/requirejs-config.js
var config =
"map":
"*":
"generateMenu": "TCM_HeaderMenu/js/generateMenu"
and in the file located in app/code/COMPANY/PRODUCT/view/adminhtml/web/js/generateMenu.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
require([
'jquery',
'logger'
], function($, logger)
'use strict';
logger.log('inchoo.js is loaded!!');
//creating jquery widget
$.widget('generateMenu.js',
_create: function()
this.element.on('click', function(e)
logger.log("You click on element: " + e.target);
);
);
return $.generateMenu.js;
);
But it seems that this is not being called when I refresh the page.
Note: I'm trying to load the custom js in Catalog->category page in the admin panel
magento2 magento-2.1 magento2.3 requirejs
add a comment |
I'm trying to add a custom js file in magento 2 in the admin but all I can see are sample on how to add in the frontend. I found some that shows how to add in admin but none works. Below are my code that I copied from some sources
//app/code/COMPANY/PRODUCT/view/adminhtml/requirejs-config.js
var config =
"map":
"*":
"generateMenu": "TCM_HeaderMenu/js/generateMenu"
and in the file located in app/code/COMPANY/PRODUCT/view/adminhtml/web/js/generateMenu.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
require([
'jquery',
'logger'
], function($, logger)
'use strict';
logger.log('inchoo.js is loaded!!');
//creating jquery widget
$.widget('generateMenu.js',
_create: function()
this.element.on('click', function(e)
logger.log("You click on element: " + e.target);
);
);
return $.generateMenu.js;
);
But it seems that this is not being called when I refresh the page.
Note: I'm trying to load the custom js in Catalog->category page in the admin panel
magento2 magento-2.1 magento2.3 requirejs
I'm trying to add a custom js file in magento 2 in the admin but all I can see are sample on how to add in the frontend. I found some that shows how to add in admin but none works. Below are my code that I copied from some sources
//app/code/COMPANY/PRODUCT/view/adminhtml/requirejs-config.js
var config =
"map":
"*":
"generateMenu": "TCM_HeaderMenu/js/generateMenu"
and in the file located in app/code/COMPANY/PRODUCT/view/adminhtml/web/js/generateMenu.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
require([
'jquery',
'logger'
], function($, logger)
'use strict';
logger.log('inchoo.js is loaded!!');
//creating jquery widget
$.widget('generateMenu.js',
_create: function()
this.element.on('click', function(e)
logger.log("You click on element: " + e.target);
);
);
return $.generateMenu.js;
);
But it seems that this is not being called when I refresh the page.
Note: I'm trying to load the custom js in Catalog->category page in the admin panel
magento2 magento-2.1 magento2.3 requirejs
magento2 magento-2.1 magento2.3 requirejs
edited Aug 1 at 12:04
Mohit Rane
1,20718 bronze badges
1,20718 bronze badges
asked Aug 1 at 11:45
MadzQuestioningMadzQuestioning
2709 bronze badges
2709 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Try :
app/code/Company/Product/view/adminhtml/requirejs-config.js
var config =
deps: [
"Company_Product/js/generateMenu"
]
;
app/code/Company/Product/view/adminhtml/web/js/generateMenu.js
define(["jquery"], function($)
"use strict";
//Your code here
);
clean cache
clean var/view_preprocessed content
clean pub/static content
deploy the static content : php bin/magento
setup:static-content:deploy -f
1
You're the star thanks a lot you saved me been looking for this answer for hours now
– MadzQuestioning
Aug 1 at 13:11
add a comment |
please try with below code :
var config =
map:
'*':
generateMenu:'TCM_HeaderMenu::js/generateMenu'
;
i hope its work for you
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f284085%2fhow-to-add-custom-js-in-admin-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try :
app/code/Company/Product/view/adminhtml/requirejs-config.js
var config =
deps: [
"Company_Product/js/generateMenu"
]
;
app/code/Company/Product/view/adminhtml/web/js/generateMenu.js
define(["jquery"], function($)
"use strict";
//Your code here
);
clean cache
clean var/view_preprocessed content
clean pub/static content
deploy the static content : php bin/magento
setup:static-content:deploy -f
1
You're the star thanks a lot you saved me been looking for this answer for hours now
– MadzQuestioning
Aug 1 at 13:11
add a comment |
Try :
app/code/Company/Product/view/adminhtml/requirejs-config.js
var config =
deps: [
"Company_Product/js/generateMenu"
]
;
app/code/Company/Product/view/adminhtml/web/js/generateMenu.js
define(["jquery"], function($)
"use strict";
//Your code here
);
clean cache
clean var/view_preprocessed content
clean pub/static content
deploy the static content : php bin/magento
setup:static-content:deploy -f
1
You're the star thanks a lot you saved me been looking for this answer for hours now
– MadzQuestioning
Aug 1 at 13:11
add a comment |
Try :
app/code/Company/Product/view/adminhtml/requirejs-config.js
var config =
deps: [
"Company_Product/js/generateMenu"
]
;
app/code/Company/Product/view/adminhtml/web/js/generateMenu.js
define(["jquery"], function($)
"use strict";
//Your code here
);
clean cache
clean var/view_preprocessed content
clean pub/static content
deploy the static content : php bin/magento
setup:static-content:deploy -f
Try :
app/code/Company/Product/view/adminhtml/requirejs-config.js
var config =
deps: [
"Company_Product/js/generateMenu"
]
;
app/code/Company/Product/view/adminhtml/web/js/generateMenu.js
define(["jquery"], function($)
"use strict";
//Your code here
);
clean cache
clean var/view_preprocessed content
clean pub/static content
deploy the static content : php bin/magento
setup:static-content:deploy -f
edited Aug 1 at 12:49
answered Aug 1 at 12:28
PЯINCƏPЯINCƏ
8,7023 gold badges11 silver badges50 bronze badges
8,7023 gold badges11 silver badges50 bronze badges
1
You're the star thanks a lot you saved me been looking for this answer for hours now
– MadzQuestioning
Aug 1 at 13:11
add a comment |
1
You're the star thanks a lot you saved me been looking for this answer for hours now
– MadzQuestioning
Aug 1 at 13:11
1
1
You're the star thanks a lot you saved me been looking for this answer for hours now
– MadzQuestioning
Aug 1 at 13:11
You're the star thanks a lot you saved me been looking for this answer for hours now
– MadzQuestioning
Aug 1 at 13:11
add a comment |
please try with below code :
var config =
map:
'*':
generateMenu:'TCM_HeaderMenu::js/generateMenu'
;
i hope its work for you
add a comment |
please try with below code :
var config =
map:
'*':
generateMenu:'TCM_HeaderMenu::js/generateMenu'
;
i hope its work for you
add a comment |
please try with below code :
var config =
map:
'*':
generateMenu:'TCM_HeaderMenu::js/generateMenu'
;
i hope its work for you
please try with below code :
var config =
map:
'*':
generateMenu:'TCM_HeaderMenu::js/generateMenu'
;
i hope its work for you
answered Aug 1 at 12:50
Anas MansuriAnas Mansuri
1,3642 silver badges16 bronze badges
1,3642 silver badges16 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f284085%2fhow-to-add-custom-js-in-admin-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown