People who code: we want your input. Take the Survey

Questions tagged [knockoutjs]

Denotes questions related to Knockout use in Magento2

Filter by
Sorted by
Tagged with
5
votes
1answer
4k views

How is product data passed from a Block to knockout template?

I'm investigating loading some product images via knockout templates. While looking for an example from the core I saw the minicart has this behaviour but right now i don't fully understand how the ...
3
votes
1answer
2k views

Passing data from a ui form component to included insertListing item

Is it possible to pass data available in a UI component in the form of a dataScope item: <field name="question"> <argument name="data" xsi:type="array"> <item name="config"...
3
votes
1answer
601 views

How Can I Resolve a RequireJS Alias in Magento 2?

From a Disqus comment on my website When I look at this file: vendor/magento/module-catalog/view/base/templates/product/price/tier_prices.phtml I see something like this <script type="text/x-...
27
votes
2answers
15k views

Magento2 translating Javascript (KO) template text

I am trying to add a translation for the text <!-- ko i18n: 'Store credit available' --><!-- /ko --> present in vendor/magento/module-customer-balance/view/frontend/web/template/payment/...
3
votes
1answer
267 views

Is it possible / what is the recommended approach to add a new custom binding to knockout in Magento 2?

I understand Magento 2 registers a number of custom knockout bindings in the Magento_Ui module, specifically through the initialize script in: vendor/magento/module-ui/view/base/web/js/lib/ko/...
2
votes
3answers
4k views

Magento 2 - Compare Products Not Showing In Sidebar

On a new site build, I'm trying to figure out why the compare products information is not showing up in the sidebar for the category page or the customer account page. It a new M2 install with a ...
4
votes
0answers
235 views

Magento 2: Admin grid table - add new row on the fly?

I created a custom UI grid table in admin. And I have a form on the same page to add new item to my custom database table(with ajax). After I added new item I need it to immediately appear in this ...
0
votes
1answer
1k views

How to reload admin grid table with js?

Is there any way to reload custom admin ui grid with ajax? Just like it reloads when you for example sorting by clicking a column name. I just need this grid table to be updated with new data. Is ...
23
votes
1answer
12k views

How Does Magento 2 Apply KnockoutJS Bindings

Per a very cursory reading of the KnockoutJS documentation, initializing a very basic Knockout view looks like the following // This is a simple *viewmodel* - JavaScript that defines the data and ...
24
votes
3answers
18k views

Magento 2: How/Where is the `getTemplate` Knockout Function Bound?

Many Magento backend pages contain the following in their source code <!-- ko template: getTemplate() --><!-- /ko --> I understand (or think I do?) that <!-- ko template is a ...
8
votes
1answer
4k views

Magento2 - How can I display a product attribute value in Order Summary block?

I am trying to display a product attribute value instead of the product name. I have found the tempplate where it is displayed: vendor/magento/module-checkout/view/frontend/web/template/summary/item/...
2
votes
2answers
1k views

Magento2 - Changes to Order Summary block are not appearing

When I edit the Order Summary block, I do not see my changes. I even modified the vendor/magento/module-checkout/view/frontend/web/template/summary/item/details.phtml template directly for testing ...
3
votes
1answer
4k views

How to overwrite lib template file - Magento 2

How can the HTML files from the library be overwritten? I need to overwrite this template: lib/web/mage/gallery/gallery.html I have tried placing the file in my own theme in the below locations, I'...
11
votes
1answer
1k views

How can I trigger code to run after knockoutjs render in adminhtml

UPDATE: You can access the viewmodels directly. If you need to trigger code to run after a render, use MutationObserver. I'll post my code as soon as I have a good working example. Original Question:...
0
votes
1answer
144 views

How to add a span tag to template in the onepage checkout?

I need to add a span-Tag next to the radio-Buttons in the payment template of the checkout. And my question is HOW DO I DO THAT? I can't find any template that matchs. There are several templates for ...
2
votes
1answer
2k views

Extend a default Ui component in adminhtml

Is there any good example code on how to work with RequireJS and knockoutJS (built into magento2) for adding additional functionality to fields in the admin side? I'm looking for Magento docs and ...
1
vote
1answer
210 views

Magento2 Custom Template KnockoutJS

I have set up a custom template and all working fine apart from KO templating is not working in the custom theme so things lick the checkoutpage is not rendering. I have the following set: - One page ...
1
vote
1answer
735 views

How does Magento 2 process ko statements and how to use them?

In Magento 2 templates I've found some ko statements such as <form class="form form-shipping-address" id="co-shipping-form" data-bind="attr: {'data-hasrequired': $t('* Required Fields')}"> <...
2
votes
0answers
131 views

Use knockout.js in catalog page in magento 2

We are developing an extension for configurable products which provides the following functionality on product page. On the product view page of the configurable product, when the customer finishes ...
11
votes
2answers
8k views

Magento 2 Add to cart frontend event listener

I am trying to find good solution to execute custom javascript when product is successfully added to cart. Also this custom javascript need information about product that was added to cart (sku, qty, ...
3
votes
1answer
1k views

How to add an IMG in knockout html template

I am trying to show an image in the knockout template but I could not. This is what I have: <img data-bind="attr: {'src': getImage()}, src: getImage()" /> <p data-bind="html: ...
0
votes
0answers
115 views

how to delete an input field in knockoutjs template in magento2

On checkout page, there is a company field that I need to remove from the shipping address form. Furthermore, I need to change the city and region fields to make them dependent dropdowns. I have ...
2
votes
0answers
4k views

Swatch customization issues

well we have heavily customized Magento 2 website. The swatch customizing is done in: app\code\My_Package\CustomSwatches\view\frontend\web\js\SwatchRenderer.js by overriding: vendor\magento\module-...
13
votes
2answers
16k views

How to use Knockout JS within Magento 2

My problem: I am attempting to write a small Knockout JS app within Magento 2, I'm struggling to initialise the app as when I use ko.applyBindings(AppViewModel, document.getElementById("koTest")); it ...
2
votes
2answers
4k views

Magento2 Knockout js - issue on cart

I tried to reposition my cart block to a other header location. Since then I am getting this javascript error which is annoying since I only repositioned a block. Uncaught TypeError: Unable to ...
3
votes
1answer
7k views

Magento 2 knockout template rendering via getTemplate

I have been checking out M2's frontend structure and I stumbled in some knockoutjs's template binding, for example in Magento/Checkout/view/frontend/web/template/shipping-address/form.html(this file ...
3
votes
2answers
5k views

How to extend js class/method of checkout model class in magento 2

Basically I need to some method overwrite/extend of following Js class. magento/module-checkout/view/frontend/web/js/model/step-navigator.js Overwrite of this class through requirejs working fine. ...
12
votes
2answers
13k views

magento2 knockoutjs custom template binding

I'm trying to understand knockoutjs in magento2.especially custom template binding.I'm not able to get idea flow of rendering this. Can any one have idea how it works? atleast Where can I find ...
33
votes
2answers
22k views

In Magento2 what is <script type=“text/x-magento-init”>?

I am new to Magento2 and our organisation has just get the EE licence. I have installed it on my local machine and the default template spits out the following mixed in with HMTL: <script type="...
4
votes
1answer
241 views

Interconnecting two different Knockout “apps” on the same page in Magento 2

I have two blocks with a jsLayout in the layout XML on a single page. Both are initialized via <script type="text/x-magento-init"> { "#checkout": { "...
9
votes
2answers
2k views

Overriding template files in own theme, loaded through JS (Knockout.js)

Since the official Magento 2.0 forums aren't of any help, i'll post my question here as well. We're in the process of building our own theme based on the Magento Blank theme and we would like to ...
15
votes
1answer
2k views

Magento 2 new grid system template

I've been poking around in the new backend grid system of Magento on the Merchant beta 1.0.0 version. First of all I must say I'm impressed. Now you can select what columns to see, you can reorder ...

1
11 12 13 14
15