Skip to main content

Mangento2: Knockout: add multiple events to data-bind attribute of one element

We can add multiple events to single data-bind attribute of one element using comma.

Example is given below:

<div data-bind="submit: navigateToNextStep, click: callanotherFunc"></div>

in this example we have added 2 events to the data-bind attribute:

First is: submit: navigateToNextStep

Second is: click: callanotherFunc

Comments

Popular posts from this blog

Magento 2: How to add custom script to head tag?

There are two ways to add custom script to head tag in Magento 2: add custom script through admin-panel add custom script through XML If you want to add custom script in head tag through admin-panel, just login to the admin and browse the navigation Content => Design => Configuration , Now click on edit link of current theme and Go to HTML Head tab and inside scripts and style sheets text-area you can enter your custom script.  If you want to add custom script through XML, just create a XML file on following location: app/design/frontend/packagename/themename/Magento_Theme/layout/default_head_blocks.xml and add the following code in this XML to call template file: <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body>         <referenceBlock name="head.additional">    ...

Magento 2: How to add menu to the admin grid?

To add new menu in admin grid, first create an menu.xml file to your module on following location: Packagename/Modulename/etc/adminhtml/menu.xml then place the following code in menu.xml: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Backend/etc/menu.xsd">     <menu>          <add id="Packagename_Modulename::urlkey" title="Menu Title" module="Packagename_Modulename"  sortOrder="10" resource="Packagename_Modulename::urlkey"/>        <add id="Packagename_Modulename::urlkey_controller_action" title="Sub Menu Title" module="Packagename_Modulename"  sortOrder="10" action="urlkey/controller/action" resource="Packagename_Modulename::urlkey_controller_action" parent="Packagename_Modulename::urlkey" />     </menu> </config> ...

Magento 2: Print Invoice PDF or Shipment PDF is not working : sh: 1: xvfb-run: not found

Some times in Magento 2, while we try to print Invoice PDF or Shipment PDF or any other PDF, then it displays following message: sh: 1: xvfb-run: not found To resolve this issue, first login to your project through SSH and run following commands on the root location of your project: sudo apt-get install --fix-missing -y xvfb sudo apt-get update sudo apt-get install xvfb libfontconfig wkhtmltopdf