Magento 2.2.5: How to console.log() in js file The Next CEO of Stack OverflowMagento 2.2.5:...
If the heap is initialized for security, then why is the stack uninitialized?
Why does C# sound extremely flat when saxophone is tuned to G?
Why here is plural "We went to the movies last night."
Visit to the USA with ESTA approved before trip to Iran
Rotate a column
Why were Madagascar and New Zealand discovered so late?
What is the point of a new vote on May's deal when the indicative votes suggest she will not win?
WOW air has ceased operation, can I get my tickets refunded?
How long to clear the 'suck zone' of a turbofan after start is initiated?
Is it safe to use c_str() on a temporary string?
Is it okay to store user locations?
Is HostGator storing my password in plaintext?
Return the Closest Prime Number
How do I solve this limit?
Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?
Unreliable Magic - Is it worth it?
How to start emacs in "nothing" mode (`fundamental-mode`)
How to write papers efficiently when English isn't my first language?
Text adventure game code
How to use tikz in fbox?
How to be diplomatic in refusing to write code that breaches the privacy of our users
Trouble understanding the speech of overseas colleagues
How easy is it to start Magic from scratch?
Are there languages with no euphemisms?
Magento 2.2.5: How to console.log() in js file
The Next CEO of Stack OverflowMagento 2.2.5: How to set checkbox checked with Grid addColumn()how to find what's the errorHow to clear billing form validation errors when using Magento UI componentsMagento 2.2.5: Idea about delete “Banner_Slide”Magento 2.2.5: How to set checkbox checked with Grid addColumn()Magento 2.2.5: How to try catch in magento with AJAX?Magento 2.2.5 : How does Catalog Widget Module JS works?How to solve Front controller reached 100 router match iterations in magento2Magento 2.2.5: Static files are not generated for custom themeMagento 2.2.5: How to validate shipping addressMagento 2.2.5 custom theme js errors
I'm trying to debug a js file in magento 2. And i dont know how to do that. I've try console.log('some thing in here'), but doesn't work, i've clear cache as well.
Here is my problem:
I've 3 checkbox here, and they count in that"input hiden" in the image below.
So when i click on the check box to turn off, it count down 1 (see the image below). It work perfecty til here.
But when i click on the check box again. It should count up 1 right, but it doesn't. I dont know where is wrong in my code.
Here is my js file named assign-slide.js (this js is following assign-product.js):
C:xampphtdocsmagentovendormagentomodule-catalogviewadminhtmlwebcatalogcategoryassign-products.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/* global $, $H */
define([
'mage/adminhtml/grid'
], function () {
'use strict';
return {
assignSlide: function(config){
var selectedSlide = config.selectedSlide,
bannerSlide = $H(selectedSlide),
gridJsObject = window[config.gridJsObjectName],
tabIndex = 1000;
$('in_banner_slide').value = Object.toJSON(bannerSlide);
/**
* Register Banner Slide
*
* @param {Object} grid
* @param {Object} element
* @param {Boolean} checked
*/
function registerBannerSlide(grid, element, checked) {
if (checked) {
if (element.positionElement) {
element.positionElement.disabled = false;
bannerSlide.set(element.value, element.positionElement.value);
}
} else {
if (element.positionElement) {
element.positionElement.disabled = true;
}
bannerSlide.unset(element.value);
}
$('in_banner_slide').value = Object.toJSON(bannerSlide);
grid.reloadParams = {
'selected_slide[]': bannerSlide.keys()
};
}
/**
* Click on Slide row
*
* @param {Object} grid
* @param {String} event
*/
function bannerSlideRowClick(grid, event) {
var trElement = Event.findElement(event, 'tr'),
isInput = Event.element(event).tagName === 'INPUT',
checked = false,
checkbox = null;
if (trElement) {
checkbox = Element.getElementsBySelector(trElement, 'input');
if (checkbox[0]) {
checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
gridJsObject.setCheckboxChecked(checkbox[0], checked);
}
}
}
/**
* Change Slide position
*
* @param {String} event
*/
function positionChange(event) {
var element = Event.element(event);
if (element && element.checkboxElement && element.checkboxElement.checked) {
bannerSlide.set(element.checkboxElement.value, element.value);
$('in_banner_slide').value = Object.toJSON(bannerSlide);
}
}
/**
* Initialize Banner Slide row
*
* @param {Object} grid
* @param {String} row
*/
function bannerSlideRowInit(grid, row) {
var checkbox = $(row).getElementsByClassName('checkbox')[0],
position = $(row).getElementsByClassName('input-text')[0];
if (checkbox && position) {
checkbox.positionElement = position;
position.checkboxElement = checkbox;
position.disabled = !checkbox.checked;
position.tabIndex = tabIndex++;
Event.observe(position, 'keyup', positionChange);
}
}
gridJsObject.rowClickCallback = bannerSlideRowClick;
gridJsObject.initRowCallback = bannerSlideRowInit;
gridJsObject.checkboxCheckCallback = registerBannerSlide;
if (gridJsObject.rows) {
gridJsObject.rows.each(function (row) {
bannerSlideRowInit(gridJsObject, row);
});
}
}};
});
EDIT 1:
So i found the way to debugging with console.log, its you go to pub/static../your_js_file_that_you_want_to_console_log.js and put console.log in there and clear cache also ctrl + F5 in your browser so it clear your browser cache as well.
But my problem with js still there.
magento2 javascript debug
add a comment |
I'm trying to debug a js file in magento 2. And i dont know how to do that. I've try console.log('some thing in here'), but doesn't work, i've clear cache as well.
Here is my problem:
I've 3 checkbox here, and they count in that"input hiden" in the image below.
So when i click on the check box to turn off, it count down 1 (see the image below). It work perfecty til here.
But when i click on the check box again. It should count up 1 right, but it doesn't. I dont know where is wrong in my code.
Here is my js file named assign-slide.js (this js is following assign-product.js):
C:xampphtdocsmagentovendormagentomodule-catalogviewadminhtmlwebcatalogcategoryassign-products.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/* global $, $H */
define([
'mage/adminhtml/grid'
], function () {
'use strict';
return {
assignSlide: function(config){
var selectedSlide = config.selectedSlide,
bannerSlide = $H(selectedSlide),
gridJsObject = window[config.gridJsObjectName],
tabIndex = 1000;
$('in_banner_slide').value = Object.toJSON(bannerSlide);
/**
* Register Banner Slide
*
* @param {Object} grid
* @param {Object} element
* @param {Boolean} checked
*/
function registerBannerSlide(grid, element, checked) {
if (checked) {
if (element.positionElement) {
element.positionElement.disabled = false;
bannerSlide.set(element.value, element.positionElement.value);
}
} else {
if (element.positionElement) {
element.positionElement.disabled = true;
}
bannerSlide.unset(element.value);
}
$('in_banner_slide').value = Object.toJSON(bannerSlide);
grid.reloadParams = {
'selected_slide[]': bannerSlide.keys()
};
}
/**
* Click on Slide row
*
* @param {Object} grid
* @param {String} event
*/
function bannerSlideRowClick(grid, event) {
var trElement = Event.findElement(event, 'tr'),
isInput = Event.element(event).tagName === 'INPUT',
checked = false,
checkbox = null;
if (trElement) {
checkbox = Element.getElementsBySelector(trElement, 'input');
if (checkbox[0]) {
checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
gridJsObject.setCheckboxChecked(checkbox[0], checked);
}
}
}
/**
* Change Slide position
*
* @param {String} event
*/
function positionChange(event) {
var element = Event.element(event);
if (element && element.checkboxElement && element.checkboxElement.checked) {
bannerSlide.set(element.checkboxElement.value, element.value);
$('in_banner_slide').value = Object.toJSON(bannerSlide);
}
}
/**
* Initialize Banner Slide row
*
* @param {Object} grid
* @param {String} row
*/
function bannerSlideRowInit(grid, row) {
var checkbox = $(row).getElementsByClassName('checkbox')[0],
position = $(row).getElementsByClassName('input-text')[0];
if (checkbox && position) {
checkbox.positionElement = position;
position.checkboxElement = checkbox;
position.disabled = !checkbox.checked;
position.tabIndex = tabIndex++;
Event.observe(position, 'keyup', positionChange);
}
}
gridJsObject.rowClickCallback = bannerSlideRowClick;
gridJsObject.initRowCallback = bannerSlideRowInit;
gridJsObject.checkboxCheckCallback = registerBannerSlide;
if (gridJsObject.rows) {
gridJsObject.rows.each(function (row) {
bannerSlideRowInit(gridJsObject, row);
});
}
}};
});
EDIT 1:
So i found the way to debugging with console.log, its you go to pub/static../your_js_file_that_you_want_to_console_log.js and put console.log in there and clear cache also ctrl + F5 in your browser so it clear your browser cache as well.
But my problem with js still there.
magento2 javascript debug
Please share your full code.
– kunj
Aug 11 '18 at 9:37
1
Oh, i've a bigger problem now, please check. magento.stackexchange.com/questions/238050/… Thanks :)
– fudu
Aug 11 '18 at 9:43
add a comment |
I'm trying to debug a js file in magento 2. And i dont know how to do that. I've try console.log('some thing in here'), but doesn't work, i've clear cache as well.
Here is my problem:
I've 3 checkbox here, and they count in that"input hiden" in the image below.
So when i click on the check box to turn off, it count down 1 (see the image below). It work perfecty til here.
But when i click on the check box again. It should count up 1 right, but it doesn't. I dont know where is wrong in my code.
Here is my js file named assign-slide.js (this js is following assign-product.js):
C:xampphtdocsmagentovendormagentomodule-catalogviewadminhtmlwebcatalogcategoryassign-products.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/* global $, $H */
define([
'mage/adminhtml/grid'
], function () {
'use strict';
return {
assignSlide: function(config){
var selectedSlide = config.selectedSlide,
bannerSlide = $H(selectedSlide),
gridJsObject = window[config.gridJsObjectName],
tabIndex = 1000;
$('in_banner_slide').value = Object.toJSON(bannerSlide);
/**
* Register Banner Slide
*
* @param {Object} grid
* @param {Object} element
* @param {Boolean} checked
*/
function registerBannerSlide(grid, element, checked) {
if (checked) {
if (element.positionElement) {
element.positionElement.disabled = false;
bannerSlide.set(element.value, element.positionElement.value);
}
} else {
if (element.positionElement) {
element.positionElement.disabled = true;
}
bannerSlide.unset(element.value);
}
$('in_banner_slide').value = Object.toJSON(bannerSlide);
grid.reloadParams = {
'selected_slide[]': bannerSlide.keys()
};
}
/**
* Click on Slide row
*
* @param {Object} grid
* @param {String} event
*/
function bannerSlideRowClick(grid, event) {
var trElement = Event.findElement(event, 'tr'),
isInput = Event.element(event).tagName === 'INPUT',
checked = false,
checkbox = null;
if (trElement) {
checkbox = Element.getElementsBySelector(trElement, 'input');
if (checkbox[0]) {
checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
gridJsObject.setCheckboxChecked(checkbox[0], checked);
}
}
}
/**
* Change Slide position
*
* @param {String} event
*/
function positionChange(event) {
var element = Event.element(event);
if (element && element.checkboxElement && element.checkboxElement.checked) {
bannerSlide.set(element.checkboxElement.value, element.value);
$('in_banner_slide').value = Object.toJSON(bannerSlide);
}
}
/**
* Initialize Banner Slide row
*
* @param {Object} grid
* @param {String} row
*/
function bannerSlideRowInit(grid, row) {
var checkbox = $(row).getElementsByClassName('checkbox')[0],
position = $(row).getElementsByClassName('input-text')[0];
if (checkbox && position) {
checkbox.positionElement = position;
position.checkboxElement = checkbox;
position.disabled = !checkbox.checked;
position.tabIndex = tabIndex++;
Event.observe(position, 'keyup', positionChange);
}
}
gridJsObject.rowClickCallback = bannerSlideRowClick;
gridJsObject.initRowCallback = bannerSlideRowInit;
gridJsObject.checkboxCheckCallback = registerBannerSlide;
if (gridJsObject.rows) {
gridJsObject.rows.each(function (row) {
bannerSlideRowInit(gridJsObject, row);
});
}
}};
});
EDIT 1:
So i found the way to debugging with console.log, its you go to pub/static../your_js_file_that_you_want_to_console_log.js and put console.log in there and clear cache also ctrl + F5 in your browser so it clear your browser cache as well.
But my problem with js still there.
magento2 javascript debug
I'm trying to debug a js file in magento 2. And i dont know how to do that. I've try console.log('some thing in here'), but doesn't work, i've clear cache as well.
Here is my problem:
I've 3 checkbox here, and they count in that"input hiden" in the image below.
So when i click on the check box to turn off, it count down 1 (see the image below). It work perfecty til here.
But when i click on the check box again. It should count up 1 right, but it doesn't. I dont know where is wrong in my code.
Here is my js file named assign-slide.js (this js is following assign-product.js):
C:xampphtdocsmagentovendormagentomodule-catalogviewadminhtmlwebcatalogcategoryassign-products.js
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/* global $, $H */
define([
'mage/adminhtml/grid'
], function () {
'use strict';
return {
assignSlide: function(config){
var selectedSlide = config.selectedSlide,
bannerSlide = $H(selectedSlide),
gridJsObject = window[config.gridJsObjectName],
tabIndex = 1000;
$('in_banner_slide').value = Object.toJSON(bannerSlide);
/**
* Register Banner Slide
*
* @param {Object} grid
* @param {Object} element
* @param {Boolean} checked
*/
function registerBannerSlide(grid, element, checked) {
if (checked) {
if (element.positionElement) {
element.positionElement.disabled = false;
bannerSlide.set(element.value, element.positionElement.value);
}
} else {
if (element.positionElement) {
element.positionElement.disabled = true;
}
bannerSlide.unset(element.value);
}
$('in_banner_slide').value = Object.toJSON(bannerSlide);
grid.reloadParams = {
'selected_slide[]': bannerSlide.keys()
};
}
/**
* Click on Slide row
*
* @param {Object} grid
* @param {String} event
*/
function bannerSlideRowClick(grid, event) {
var trElement = Event.findElement(event, 'tr'),
isInput = Event.element(event).tagName === 'INPUT',
checked = false,
checkbox = null;
if (trElement) {
checkbox = Element.getElementsBySelector(trElement, 'input');
if (checkbox[0]) {
checked = isInput ? checkbox[0].checked : !checkbox[0].checked;
gridJsObject.setCheckboxChecked(checkbox[0], checked);
}
}
}
/**
* Change Slide position
*
* @param {String} event
*/
function positionChange(event) {
var element = Event.element(event);
if (element && element.checkboxElement && element.checkboxElement.checked) {
bannerSlide.set(element.checkboxElement.value, element.value);
$('in_banner_slide').value = Object.toJSON(bannerSlide);
}
}
/**
* Initialize Banner Slide row
*
* @param {Object} grid
* @param {String} row
*/
function bannerSlideRowInit(grid, row) {
var checkbox = $(row).getElementsByClassName('checkbox')[0],
position = $(row).getElementsByClassName('input-text')[0];
if (checkbox && position) {
checkbox.positionElement = position;
position.checkboxElement = checkbox;
position.disabled = !checkbox.checked;
position.tabIndex = tabIndex++;
Event.observe(position, 'keyup', positionChange);
}
}
gridJsObject.rowClickCallback = bannerSlideRowClick;
gridJsObject.initRowCallback = bannerSlideRowInit;
gridJsObject.checkboxCheckCallback = registerBannerSlide;
if (gridJsObject.rows) {
gridJsObject.rows.each(function (row) {
bannerSlideRowInit(gridJsObject, row);
});
}
}};
});
EDIT 1:
So i found the way to debugging with console.log, its you go to pub/static../your_js_file_that_you_want_to_console_log.js and put console.log in there and clear cache also ctrl + F5 in your browser so it clear your browser cache as well.
But my problem with js still there.
magento2 javascript debug
magento2 javascript debug
edited 6 mins ago
Teja Bhagavan Kollepara
3,01241949
3,01241949
asked Aug 11 '18 at 1:49
fudufudu
42311
42311
Please share your full code.
– kunj
Aug 11 '18 at 9:37
1
Oh, i've a bigger problem now, please check. magento.stackexchange.com/questions/238050/… Thanks :)
– fudu
Aug 11 '18 at 9:43
add a comment |
Please share your full code.
– kunj
Aug 11 '18 at 9:37
1
Oh, i've a bigger problem now, please check. magento.stackexchange.com/questions/238050/… Thanks :)
– fudu
Aug 11 '18 at 9:43
Please share your full code.
– kunj
Aug 11 '18 at 9:37
Please share your full code.
– kunj
Aug 11 '18 at 9:37
1
1
Oh, i've a bigger problem now, please check. magento.stackexchange.com/questions/238050/… Thanks :)
– fudu
Aug 11 '18 at 9:43
Oh, i've a bigger problem now, please check. magento.stackexchange.com/questions/238050/… Thanks :)
– fudu
Aug 11 '18 at 9:43
add a comment |
0
active
oldest
votes
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%2f238034%2fmagento-2-2-5-how-to-console-log-in-js-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f238034%2fmagento-2-2-5-how-to-console-log-in-js-file%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
Please share your full code.
– kunj
Aug 11 '18 at 9:37
1
Oh, i've a bigger problem now, please check. magento.stackexchange.com/questions/238050/… Thanks :)
– fudu
Aug 11 '18 at 9:43