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

Why did we only see the N-1 starfighters in one film?

How to write the block matrix in LaTex?

Should I tutor a student who I know has cheated on their homework?

Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?

Was a professor correct to chastise me for writing "Prof. X" rather than "Professor X"?

What is the point of a new vote on May's deal when the indicative votes suggest she will not win?

What makes a siege story/plot interesting?

How easy is it to start Magic from scratch?

The King's new dress

Why does standard notation not preserve intervals (visually)

Why does C# sound extremely flat when saxophone is tuned to G?

If the heap is initialized for security, then why is the stack uninitialized?

Visit to the USA with ESTA approved before trip to Iran

Grabbing quick drinks

What does "Its cash flow is deeply negative" mean?

What is the difference between "behavior" and "behaviour"?

Does the Brexit deal have to be agreed by both Houses?

Need some help with wall behind rangetop

How to Reset Passwords on Multiple Websites Easily?

% symbol leads to superlong (forever?) compilations

Can a caster that cast Polymorph on themselves stop concentrating at any point even if their Int is low?

How can I quit an app using Terminal?

How do I get the green key off the shelf in the Dobby level of Lego Harry Potter 2?

Trouble understanding the speech of overseas colleagues



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










2















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.
enter image description here



So when i click on the check box to turn off, it count down 1 (see the image below). It work perfecty til here.
enter image description 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.










share|improve this question
























  • 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















2















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.
enter image description here



So when i click on the check box to turn off, it count down 1 (see the image below). It work perfecty til here.
enter image description 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.










share|improve this question
























  • 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













2












2








2








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.
enter image description here



So when i click on the check box to turn off, it count down 1 (see the image below). It work perfecty til here.
enter image description 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.










share|improve this question
















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.
enter image description here



So when i click on the check box to turn off, it count down 1 (see the image below). It work perfecty til here.
enter image description 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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 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

















  • 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










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
);



);













draft saved

draft discarded


















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















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2

Nissan Patrol Зміст Перше покоління — 4W60 (1951-1960) | Друге покоління — 60 series (1960-1980) | Третє покоління (1980–2002) | Четверте покоління — Y60 (1987–1998) | П'яте покоління — Y61 (1997–2013) | Шосте покоління — Y62 (2010- ) | Посилання | Зноски | Навігаційне менюОфіційний український сайтТест-драйв Nissan Patrol 2010 7-го поколінняNissan PatrolКак мы тестировали Nissan Patrol 2016рвиправивши або дописавши її