From 3994790216af0ec9d37233d7b046a753a3bb4699 Mon Sep 17 00:00:00 2001 From: Yogesh Suhagiya Date: Fri, 4 May 2018 15:02:23 +0530 Subject: [PATCH] Refactor JS code and added JS component file --- .../base/templates/control/button/split.phtml | 18 ++++++++---------- .../base/web/js/grid/controls/button/split.js | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 app/code/Magento/Ui/view/base/web/js/grid/controls/button/split.js diff --git a/app/code/Magento/Ui/view/base/templates/control/button/split.phtml b/app/code/Magento/Ui/view/base/templates/control/button/split.phtml index a660f7e592331..757b1d3a4e425 100644 --- a/app/code/Magento/Ui/view/base/templates/control/button/split.phtml +++ b/app/code/Magento/Ui/view/base/templates/control/button/split.phtml @@ -17,7 +17,7 @@ hasSplit()): ?> getDisabled()): ?> @@ -40,12 +40,10 @@ - - + \ No newline at end of file diff --git a/app/code/Magento/Ui/view/base/web/js/grid/controls/button/split.js b/app/code/Magento/Ui/view/base/web/js/grid/controls/button/split.js new file mode 100644 index 0000000000000..d5a198052fd0c --- /dev/null +++ b/app/code/Magento/Ui/view/base/web/js/grid/controls/button/split.js @@ -0,0 +1,17 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'jquery' +], function ($) { + 'use strict'; + + return function (data, element) { + + $(element).on('click.splitDefault', '.action-default', function () { + $(this).siblings('.dropdown-menu').find('.item-default').trigger('click'); + }); + }; +}); \ No newline at end of file