SlideShare a Scribd company logo
1 of 19
Why async?
◉ Because of modularity of server side app:
- data-mage-init
- Layout XML declarations
- UI Components XML declarations
◉ Asynchronous JavaScript modules loaders
◉ Many user interactions are asynchronous
◉ Performance considerations
How to maintain async?
new MutationObserver (
function(mutations) {
// array of MutationRecord
}
);
Browser Chrome Firefox
Internet
Explorer
Opera Safari
Starting from 18 14 11 15 6.0
UiComponent
define(['uiElement'],
function (Element) {
return Element.extend({…});
}
);
uiRegistry
define(['uiRegistry'], function (r) {
r.get('cmp’, function (c) {};); // sync
var p = reg.promise('cmp'); // async
p.done(function (c) {};);
});
component
UiRegistry
component a
component b
component c
(source)
Practice 0: remote control
require(['uiRegistry'], function (reg) {
var c = reg.get('index=customer_columns');
c.insertChild(c.getChild('name'), c.getChild('gender'));
});
Practice 1: Apply Filter
require(['uiRegistry'], function (reg) {
var c = reg.get('index=listing_filters');
c.setData({"email":”user_1@example.com"}).apply();
});
Practice 1: Apply Filter
require(['uiRegistry'], function (reg) {
var c = reg.get('index=customer_listing_data_source');
c.set('params.filters.email', ’user_2@example.com ');
});
does not work
Practice 1: Apply Filter
// hack filters.js (change “exports” to “links”)
require(['uiRegistry'], function (reg) {
var c = reg.get('index=customer_listing_data_source');
c.set('params.filters.email', 'user_2@example.com');
});
Practice 2: Apply search filter
require(['uiRegistry'], function(r) {
r.async("index=fulltext") (function (c) {
c.set('value', 'keyword');
});
});
async.js
$.async(‘CSS selector’, function callback);
Practice 3: DOM modification
require(
['Magento_Ui/js/lib/view/utils/async'],
function($) {
$.async(
'span',
function(dom) {
dom.style.border='1px solid #ff0000';
}
);
}
);
async.js
$.async({…}, function callback);
{
"component": 'cms_page_listing',
"ctx": 'div', // CSS selector/Element
"selector": 'span’ // CSS selector
}
Practice 3: DOM modification
require(
['Magento_Ui/js/lib/view/utils/async'],
function($) {
$.async(
{
"component": "index=related_product_listing",
"selector": "span"
},
function(dom) {
dom.style.border='1px solid #ff0000';
}
);
}
);
Practice 4 (see UiWorkshop module)
Adding
‘goToFirstPage’
and ‘goToLastPage’
buttons to pager
Practice 5 (see UiWorkshop module)
Disable ’save’ button
in inline editor
unless something
has changed
Practice 6 (see UiWorkshop module)
Improving keyboard
navigation on
Categories selection
tree
Mage Titans - Workshop - UI Components

More Related Content

What's hot

OSC2007-niigata - mashup
OSC2007-niigata - mashupOSC2007-niigata - mashup
OSC2007-niigata - mashup
Yuichiro MASUI
 

What's hot (20)

Reactive Angular 2
Reactive Angular 2Reactive Angular 2
Reactive Angular 2
 
ruby-on-rails-and-ember-cli
ruby-on-rails-and-ember-cliruby-on-rails-and-ember-cli
ruby-on-rails-and-ember-cli
 
ECMAScript 6 and the Node Driver
ECMAScript 6 and the Node DriverECMAScript 6 and the Node Driver
ECMAScript 6 and the Node Driver
 
Open World Forum 2014 : From ES6 to Javascript 2.0. What use today ? par Jon...
Open World Forum 2014  : From ES6 to Javascript 2.0. What use today ? par Jon...Open World Forum 2014  : From ES6 to Javascript 2.0. What use today ? par Jon...
Open World Forum 2014 : From ES6 to Javascript 2.0. What use today ? par Jon...
 
OSC2007-niigata - mashup
OSC2007-niigata - mashupOSC2007-niigata - mashup
OSC2007-niigata - mashup
 
Игорь Фесенко "Web Apps Performance & JavaScript Compilers"
Игорь Фесенко "Web Apps Performance & JavaScript Compilers"Игорь Фесенко "Web Apps Performance & JavaScript Compilers"
Игорь Фесенко "Web Apps Performance & JavaScript Compilers"
 
Ansible Israel Kickoff Meetup
Ansible Israel Kickoff MeetupAnsible Israel Kickoff Meetup
Ansible Israel Kickoff Meetup
 
CocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads Toulouse - Guillaume Cerquant - UIViewCocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads Toulouse - Guillaume Cerquant - UIView
 
DataEngConf SF16 - Routing Billions of Analytics Events with High Deliverability
DataEngConf SF16 - Routing Billions of Analytics Events with High DeliverabilityDataEngConf SF16 - Routing Billions of Analytics Events with High Deliverability
DataEngConf SF16 - Routing Billions of Analytics Events with High Deliverability
 
MVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire LhotelierMVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire Lhotelier
 
CocoaHeads Paris - CATransaction: What the flush?!
CocoaHeads Paris - CATransaction: What the flush?!CocoaHeads Paris - CATransaction: What the flush?!
CocoaHeads Paris - CATransaction: What the flush?!
 
Building a Single Page App: One Page at a Time
Building a Single Page App: One Page at a TimeBuilding a Single Page App: One Page at a Time
Building a Single Page App: One Page at a Time
 
Curso de Node.js e MongoDB - 16
Curso de Node.js e MongoDB - 16Curso de Node.js e MongoDB - 16
Curso de Node.js e MongoDB - 16
 
Zenly - Reverse geocoding
Zenly - Reverse geocodingZenly - Reverse geocoding
Zenly - Reverse geocoding
 
openconfigd
openconfigdopenconfigd
openconfigd
 
What's new in WorkManager-Andri Suranta Ginting (Product Engineer-Gojek)
What's new in WorkManager-Andri Suranta Ginting (Product Engineer-Gojek)What's new in WorkManager-Andri Suranta Ginting (Product Engineer-Gojek)
What's new in WorkManager-Andri Suranta Ginting (Product Engineer-Gojek)
 
C++ programming basics
C++ programming basicsC++ programming basics
C++ programming basics
 
jsDay 2016 recap
jsDay 2016 recapjsDay 2016 recap
jsDay 2016 recap
 
Mca 2nd sem u-4 operator overloading
Mca 2nd  sem u-4 operator overloadingMca 2nd  sem u-4 operator overloading
Mca 2nd sem u-4 operator overloading
 
OpenStreetMap is Data
OpenStreetMap is DataOpenStreetMap is Data
OpenStreetMap is Data
 

Viewers also liked

Creativity & Innovation - Technique - TEDO
Creativity & Innovation - Technique - TEDOCreativity & Innovation - Technique - TEDO
Creativity & Innovation - Technique - TEDO
MayankRohatgi
 
Innovation workshops
Innovation workshopsInnovation workshops
Innovation workshops
MemeTime
 
Examples of innovation games
Examples of innovation gamesExamples of innovation games
Examples of innovation games
Ravi Tadwalkar
 

Viewers also liked (20)

Firefox 3.5 Launch: Creative Workshop
Firefox 3.5 Launch: Creative WorkshopFirefox 3.5 Launch: Creative Workshop
Firefox 3.5 Launch: Creative Workshop
 
Innovation Workshop
Innovation WorkshopInnovation Workshop
Innovation Workshop
 
UI/UX Workshop
UI/UX WorkshopUI/UX Workshop
UI/UX Workshop
 
Creativity & Innovation - Technique - TEDO
Creativity & Innovation - Technique - TEDOCreativity & Innovation - Technique - TEDO
Creativity & Innovation - Technique - TEDO
 
Innovation Survey
Innovation SurveyInnovation Survey
Innovation Survey
 
Workshop Innovation War Room
Workshop Innovation War RoomWorkshop Innovation War Room
Workshop Innovation War Room
 
Top 5 Usability Principles
Top 5 Usability PrinciplesTop 5 Usability Principles
Top 5 Usability Principles
 
Innovation Workshop –Games and Reality
Innovation Workshop –Games and RealityInnovation Workshop –Games and Reality
Innovation Workshop –Games and Reality
 
Workshop: Innovation Games
Workshop: Innovation GamesWorkshop: Innovation Games
Workshop: Innovation Games
 
Le wagon UI & design crash course
Le wagon UI & design crash courseLe wagon UI & design crash course
Le wagon UI & design crash course
 
The 7 Navigation Types of Web Site
The 7 Navigation Types of Web SiteThe 7 Navigation Types of Web Site
The 7 Navigation Types of Web Site
 
Innovation workshop
Innovation workshopInnovation workshop
Innovation workshop
 
Talk : Innovation Games : Perfecting Your Brainstorming Technique for Killer...
Talk : Innovation Games : Perfecting Your Brainstorming Technique for  Killer...Talk : Innovation Games : Perfecting Your Brainstorming Technique for  Killer...
Talk : Innovation Games : Perfecting Your Brainstorming Technique for Killer...
 
UX/UI Workshop: Prototyping magic
UX/UI Workshop: Prototyping magicUX/UI Workshop: Prototyping magic
UX/UI Workshop: Prototyping magic
 
Innovation Techniques
Innovation TechniquesInnovation Techniques
Innovation Techniques
 
Innovation workshops
Innovation workshopsInnovation workshops
Innovation workshops
 
Examples of innovation games
Examples of innovation gamesExamples of innovation games
Examples of innovation games
 
Workshop : Innovation Games at NSSpain
Workshop : Innovation Games at NSSpainWorkshop : Innovation Games at NSSpain
Workshop : Innovation Games at NSSpain
 
Disney’s creative strategy - the dreamer, the realist and the critic - creati...
Disney’s creative strategy - the dreamer, the realist and the critic - creati...Disney’s creative strategy - the dreamer, the realist and the critic - creati...
Disney’s creative strategy - the dreamer, the realist and the critic - creati...
 
Innovation 101 Workshop
Innovation 101 WorkshopInnovation 101 Workshop
Innovation 101 Workshop
 

Similar to Mage Titans - Workshop - UI Components

How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js framework
Ben Lin
 
Service Worker Presentation
Service Worker PresentationService Worker Presentation
Service Worker Presentation
Kyle Dorman
 

Similar to Mage Titans - Workshop - UI Components (20)

Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
Intoduction to Play Framework
Intoduction to Play FrameworkIntoduction to Play Framework
Intoduction to Play Framework
 
"Service Worker: Let Your Web App Feel Like a Native "
"Service Worker: Let Your Web App Feel Like a Native ""Service Worker: Let Your Web App Feel Like a Native "
"Service Worker: Let Your Web App Feel Like a Native "
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js framework
 
Workshop 13: AngularJS Parte II
Workshop 13: AngularJS Parte IIWorkshop 13: AngularJS Parte II
Workshop 13: AngularJS Parte II
 
[W3C HTML5 2016] Angular + ES6
[W3C HTML5 2016] Angular + ES6[W3C HTML5 2016] Angular + ES6
[W3C HTML5 2016] Angular + ES6
 
2016 W3C Conference #4 : ANGULAR + ES6
2016 W3C Conference #4 : ANGULAR + ES62016 W3C Conference #4 : ANGULAR + ES6
2016 W3C Conference #4 : ANGULAR + ES6
 
JSChannel 2017 - Service Workers and the Role they Play in modern day web-apps
JSChannel 2017 - Service Workers and the Role they Play in modern day web-appsJSChannel 2017 - Service Workers and the Role they Play in modern day web-apps
JSChannel 2017 - Service Workers and the Role they Play in modern day web-apps
 
Angular 1 + es6
Angular 1 + es6Angular 1 + es6
Angular 1 + es6
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
 
Building Progressive Web Apps for Windows devices
Building Progressive Web Apps for Windows devicesBuilding Progressive Web Apps for Windows devices
Building Progressive Web Apps for Windows devices
 
Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018Angular for Java Enterprise Developers: Oracle Code One 2018
Angular for Java Enterprise Developers: Oracle Code One 2018
 
Service Worker Presentation
Service Worker PresentationService Worker Presentation
Service Worker Presentation
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress Developers
 
Création d'application Ionic & Angular & Drupal 8
Création d'application Ionic & Angular & Drupal 8Création d'application Ionic & Angular & Drupal 8
Création d'application Ionic & Angular & Drupal 8
 
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
 
Serverless in-action
Serverless in-actionServerless in-action
Serverless in-action
 
MeasureCamp IX (London) - 10 JavaScript Concepts for web analysts
MeasureCamp IX (London) - 10 JavaScript Concepts for web analystsMeasureCamp IX (London) - 10 JavaScript Concepts for web analysts
MeasureCamp IX (London) - 10 JavaScript Concepts for web analysts
 
C#on linux
C#on linuxC#on linux
C#on linux
 

Recently uploaded

( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
nilamkumrai
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
Diya Sharma
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Recently uploaded (20)

(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Samalka Delhi >༒8448380779 Escort Service
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
 

Mage Titans - Workshop - UI Components

  • 1.
  • 2. Why async? ◉ Because of modularity of server side app: - data-mage-init - Layout XML declarations - UI Components XML declarations ◉ Asynchronous JavaScript modules loaders ◉ Many user interactions are asynchronous ◉ Performance considerations
  • 3. How to maintain async? new MutationObserver ( function(mutations) { // array of MutationRecord } ); Browser Chrome Firefox Internet Explorer Opera Safari Starting from 18 14 11 15 6.0
  • 5. uiRegistry define(['uiRegistry'], function (r) { r.get('cmp’, function (c) {};); // sync var p = reg.promise('cmp'); // async p.done(function (c) {};); });
  • 7. Practice 0: remote control require(['uiRegistry'], function (reg) { var c = reg.get('index=customer_columns'); c.insertChild(c.getChild('name'), c.getChild('gender')); });
  • 8. Practice 1: Apply Filter require(['uiRegistry'], function (reg) { var c = reg.get('index=listing_filters'); c.setData({"email":”user_1@example.com"}).apply(); });
  • 9. Practice 1: Apply Filter require(['uiRegistry'], function (reg) { var c = reg.get('index=customer_listing_data_source'); c.set('params.filters.email', ’user_2@example.com '); }); does not work
  • 10. Practice 1: Apply Filter // hack filters.js (change “exports” to “links”) require(['uiRegistry'], function (reg) { var c = reg.get('index=customer_listing_data_source'); c.set('params.filters.email', 'user_2@example.com'); });
  • 11. Practice 2: Apply search filter require(['uiRegistry'], function(r) { r.async("index=fulltext") (function (c) { c.set('value', 'keyword'); }); });
  • 13. Practice 3: DOM modification require( ['Magento_Ui/js/lib/view/utils/async'], function($) { $.async( 'span', function(dom) { dom.style.border='1px solid #ff0000'; } ); } );
  • 14. async.js $.async({…}, function callback); { "component": 'cms_page_listing', "ctx": 'div', // CSS selector/Element "selector": 'span’ // CSS selector }
  • 15. Practice 3: DOM modification require( ['Magento_Ui/js/lib/view/utils/async'], function($) { $.async( { "component": "index=related_product_listing", "selector": "span" }, function(dom) { dom.style.border='1px solid #ff0000'; } ); } );
  • 16. Practice 4 (see UiWorkshop module) Adding ‘goToFirstPage’ and ‘goToLastPage’ buttons to pager
  • 17. Practice 5 (see UiWorkshop module) Disable ’save’ button in inline editor unless something has changed
  • 18. Practice 6 (see UiWorkshop module) Improving keyboard navigation on Categories selection tree

Editor's Notes

  1. MutationObserver provides developers a way to react to changes in a DOM. It is designed as a replacement for Mutation Events defined in the DOM3 Events specification.
  2. Show the API
  3. require( ['Magento_Ui/js/lib/view/utils/async'], function($) { $.async( {"component":"index=related_product_listing", "selector":'span'}, function(dom) { dom.style.border='1px solid #ff0000'; } ); } );
  4. require( ['Magento_Ui/js/lib/view/utils/async'], function($) { $.async( {"component":"index=related_product_listing", "selector":'span'}, function(dom) { dom.style.border='1px solid #ff0000'; } ); } );
  5. require('ko').dataFor(document.querySelectorAll('div.action-select.admin__action-multiselect')[1]).component