File tree Expand file tree Collapse file tree 3 files changed +28
-11
lines changed
web/js/grid/controls/button Expand file tree Collapse file tree 3 files changed +28
-11
lines changed Original file line number Diff line number Diff line change 1717 * Example:
1818 * <block name="my.block" class="Magento\Backend\Block\Template" template="My_Module::template.phtml" >
1919 * <arguments>
20- * <argument name="viewModel " xsi:type="object">My\Module\ViewModel\Custom</argument>
20+ * <argument name="view_model " xsi:type="object">My\Module\ViewModel\Custom</argument>
2121 * </arguments>
2222 * </block>
2323 *
24+ * Your class object can then be accessed by doing $block->getViewModel()
25+ *
2426 * @api
2527 * @SuppressWarnings(PHPMD.NumberOfChildren)
2628 * @since 100.0.2
Original file line number Diff line number Diff line change 1717 </button>
1818 <?php if ($ block ->hasSplit ()): ?>
1919 <button <?= $ block ->getToggleAttributesHtml () ?> >
20- <span>Select</span>
20+ <span><?= /* @escapeNotVerified */ __ ( ' Select ' ); ?> </span>
2121 </button>
2222
2323 <?php if (!$ block ->getDisabled ()): ?>
4040 <?php endif ; ?>
4141 <?php endif ; ?>
4242</div>
43-
44- <script>
45- require(['jquery'], function($){
46- $('.actions-split')
47- .on('click.splitDefault', '.action-default', function() {
48- $(this).siblings('.dropdown-menu').find('.item-default').trigger('click');
49- });
50- });
51- </script>
43+ <script type="text/x-magento-init">
44+ {
45+ ".actions-split": {
46+ "Magento_Ui/js/grid/controls/button/split": {}
47+ }
48+ }
49+ </script>
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright © Magento, Inc. All rights reserved.
3+ * See COPYING.txt for license details.
4+ */
5+
6+ define ( [
7+ 'jquery'
8+ ] , function ( $ ) {
9+ 'use strict' ;
10+
11+ return function ( data , element ) {
12+
13+ $ ( element ) . on ( 'click.splitDefault' , '.action-default' , function ( ) {
14+ $ ( this ) . siblings ( '.dropdown-menu' ) . find ( '.item-default' ) . trigger ( 'click' ) ;
15+ } ) ;
16+ } ;
17+ } ) ;
You can’t perform that action at this time.
0 commit comments