Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
before.phtml
Go to the documentation of this file.
1 <?php
6 ?>
7 <script>
8 require([
9  'Magento_Ui/js/modal/alert',
10  'prototype'
11 ], function(alert){
12 
13 //<![CDATA[
14  // Temporary Class will be replaced after refactoring of import/export functionality
15  VarienExport = Class.create();
16  VarienExport.prototype = {
17  initialize: function() {
22  this.previousGridEntity = '';
23  },
24 
28  modifyFilterGrid: function() {
29  if ($('entity') && $F('entity') && $F('entity') != 'catalog_product') {
30  $$('col:first-child').each(function(el) {
31  el.show();
32  });
33  $$('th.no-link:first-child').each(function(el) {
34  el.show();
35  });
36  $$('td.a-center').each(function(el) {
37  el.show();
38  });
39  }
40  },
41 
45  getFilter: function() {
46  if ($('entity') && $F('entity')) {
47  var url = "<?= /* @escapeNotVerified */ $block->getUrl('*/*/getFilter') ?>";
48  var entity = $F('entity');
49  if (entity != this.previousGridEntity) {
50  this.previousGridEntity = entity;
51  url += ((url.slice(-1) != '/') ? '/' : '') + 'entity/' + entity;
52  new Ajax.Request(url, {
53  method: 'post',
54  evalScripts: true,
55  onComplete: function(transport) {
56  var responseText = transport.responseText.replace(/>\s+</g, '><');
57  $('export_filter_grid_container').update(responseText);
58  this.modifyFilterGrid();
59  $('export_filter_container').show();
60  $('messages').update();
61  }.bind(this)
62  });
63  } else {
64  this.modifyFilterGrid();
65  }
66  } else {
67  this.previousGridEntity = '';
68  $('export_filter_container').hide();
69  }
70  }
71  };
72 
78  getFile = function() {
79  if ($('entity') && $F('entity')) {
80  var form = $('export_filter_form');
81  var oldAction = form.action;
82  var url = oldAction + ((oldAction.slice(-1) != '/') ? '/' : '') + 'entity/' + $F('entity')
83  + '/file_format/' + $F('file_format');
84  if ($F('fields_enclosure')) {
85  url += '/fields_enclosure/' + $F('fields_enclosure');
86  }
87  form.action = url;
88  form.submit();
89  form.action = oldAction;
90  } else {
91  alert({
92  content: 'Invalid data'
93  });
94  }
95  };
96 
97  varienExport = new VarienExport();
98 //]]>
99 
100 });
101 </script>
jquery extjs ext tree mage adminhtml form
Definition: tree.phtml:41