javascript - Sencha Touch 2: Listen for tap on two different HTML buttons -
in nested list have 2 html buttons. have listener nested list displays detailcard
holding 2 buttons, add listener action when 1 of buttons pressed. each button different, have been unable delegate 1 of buttons particular function. there way like:
listeners : { element : 'element', delegate : 'button.mybutton', tap : function() { //... } }
but multiple delegates each delegate else?
you add data attributes buttons , react accordingly:
<button data-do="showdetailcard"> <button data-do="anotheraction"> // ... listeners: { tap: { element: 'element', delegate: 'button', fn: 'doaction' } } // ... function doaction(event) { var = event.target.dataset.do; if (do === 'showdetailcard') { // show detail card } else if (do === 'anotheraction') { // action } }
Comments
Post a Comment