provider.js 911 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. define([
  6. 'underscore',
  7. 'Magento_Ui/js/grid/provider'
  8. ], function (_, Provider) {
  9. 'use strict';
  10. return Provider.extend({
  11. /**
  12. * Reload grid
  13. * @returns {exports}
  14. */
  15. reload: function () {
  16. if (this.hasFilters()) {
  17. this._super();
  18. return this;
  19. }
  20. this.trigger('reload');
  21. this.onReload({
  22. items: [],
  23. totalRecords: 0
  24. });
  25. return this;
  26. },
  27. /**
  28. * Has filters checker
  29. * @returns {Boolean}
  30. */
  31. hasFilters: function () {
  32. var params = this.params,
  33. filters = params.filters || {};
  34. return _.keys(filters).length > 1;
  35. }
  36. });
  37. });