'When I edited directly in the grid instead of the modal at the right the filter never drops but when I edit in modal and save the filter dropped

class ProductInfoDetailsViewModel {
  constructor(parent, productInfoWindowId, inventoryId, productId, supplierId, store) {
    this._parent = parent;
    this._created = false;
    this._productInfoWindowId = productInfoWindowId;
    this._inventoryId = inventoryId;
    this._productId = productId;
    this._supplierId = supplierId;

    this._store = store;
  }

  _getMvvmData(inventoryId, productId, supplierId) {
    return new Promise(function (resolve, reject) {
      $.ajax({
        url: '/ProductRowInfoSite/GetInventoryControl',
        data: {
          'inventoryId': inventoryId,
          'productId': productId,
          'supplierId': supplierId,
        },
        dataType: 'json', // "jsonp" is required for cross-domain requests; use "json" for same-domain requests
        success: function (result) {
          resolve(result);
        },
        error: function (jqXHR, textStatus, errorThrown) {
          reject([jqXHR, textStatus, errorThrown]);
        },
        type: 'POST',
      });
    });
  }

  async create() {
    let self = this;
    let userStore = new UserStore();
    //productInfoTextGrid
    this._productInfoDetailsViewModel = kendo.observable({

      value: {},
      close: function () {
        //$("#generalProductInfoWindow").data("kendoWindow").close();
        //closeWindow();
      },
      not: function (value) {
        return !this.get(value);
      },
      save: function (e) {
        let productInfoTextGrid = $(self._productInfoWindowId + ' ' + '#productInfoTextGrid').data('kendoGrid');

        /*     productInfoTextGrid.saveChanges();*/

        let orderUnitsGrid = $(self._productInfoWindowId + ' ' + '#orderUnitsGrid').data('kendoGrid');
        let selectedRefHistProd = null;

        try {
          selectedRefHistProd = this.get('value.SelectedRefHistProd').ProductId;
        } catch (error) {
          // may be set to null and that's fine/TK.
        }

        var data = {
          ProductId: self._productId,
          InventoryId: self._inventoryId,
          SupplierId: self._supplierId,
          Fmean: this.get('value.Fmean'),
          FMAD: this.get('value.FMAD'),
          FTrend: this.get('value.FTrend'),
          SelectedSeason: this.get('value.SelectedSeason').SeasonId,
          MinQuantity: this.get('value.MinQuantity'),
          SelectedOrderUnitNo: this.get('value.SelectedOrderUnit').UnitNo,
          LeadTime: this.get('value.LeadTime'),
          LeadTimeDeviation: this.get('value.LeadTimeDeviation'),
          StockKeepInterest: this.get('value.StockKeepInterest'),
          MaxLevel: this.get('value.MaxLevel'),
          MinLevel: this.get('value.MinLevel'),
          OrderQuantity: this.get('value.OrderQuantity'),
          ReorderLevel: this.get('value.ReorderLevel'),
          EnableManualSetRAndQ: this.get('value.EnableManualSetRAndQ'),
          ForecastError: this.get('value.ForecastError'),
          SelectedHistoryProductId: selectedRefHistProd,
        };

        var dataString = JSON.stringify(data);

        $.ajax({
          url: '/ProductRowInfoSite/SaveParameters',
          data: {
            data: dataString,
          },
          dataType: 'json',
          // "jsonp" is required for cross-domain requests; use "json" for same-domain requests

          success: function (result) {
            // notify the data source that the request succeeded
            //options.success(result);

            self._store.dispatch({ type: ActionProductInfoWindow.Saving });

            self._parent.refreshParentGrids();

          },
          error: function (result) {
            displayAjaxError(result);
          },
          type: 'POST',
        });

        let userStore = new UserStore();
        let finishSaved = userStore.translatedString('SOLOSupplier.ProductInfoWindows.FinishSaved');

        displaySuccess(finishSaved);
        productInfoTextGrid.saveChanges();
        orderUnitsGrid.saveChanges();
      },
      recalc: function () {
        var validator = $(self._productInfoWindowId).kendoValidator().data('kendoValidator');
        var a = validator.validate();

      },
      products: new kendo.data.DataSource({
        type: 'json',
        serverFiltering: true,

        pageSize: 100,
        transport: {
          read: function (options) {
            $.ajax({
              url: '/ProductRowInfoSite/GetProductInventoryList',
              data:
                {
                  'inventoryId': self._inventoryId,
                  'productId': self._productId,
                  'data': options.data,
                },
              //"filter": filter
              dataType: 'json', // "jsonp" is required for cross-domain requests; use "json" for same-domain requests
              success: function (result) {
                // notify the data source that the request succeeded
                options.success(result.HistProducts);
              },
              error: function (result) {
                // notify the data source that the request failed
                options.error(result);
              },
              type: 'POST',
            });
          },
          parameterMap: function (data, type) {
            return kendo.stringify($.extend({ 'text': $(data.filter.filters).get(0).value }, data));
          },
        },
      }),
      isEnabled: true,
      onValidate: function (e) {
        console.log('onValidate');

        let maxLevel = this.get('value.MaxLevel');
        let minLevel = this.get('value.MinLevel');

        let userStore = new UserStore();
        let validationErrorMessage = userStore.translatedString('uctrlSupplierWeb.MaxLevelMinLevelWarning');

        let validator = $(self._productInfoWindowId).kendoValidator({
            messages: {
              custom: validationErrorMessage,
            },
            rules: {
              custom: function (input) {
                if (input.is('[name=minLevelParameter]') && input.val() === '') {
                  return true;
                } else if (input.is('[name=minLevelParameter]') && input.val() !== '' && maxLevel !== null) {
                  return maxLevel > minLevel;
                }
                if (input.is('[name=maxLevelParameter]') && input.val() === '') {
                  return true;
                } else if (input.is('[name=maxLevelParameter]') && input.val() !== '' && minLevel !== null) {
                  return maxLevel > minLevel;
                } else {
                  return true;
                }
              },
            },
          },
        ).data('kendoValidator');

        if (validator.validate() === true) {
          self._store.dispatch({ type: ActionProductInfoWindow.Changing });
        } else {
          self._store.dispatch({ type: ActionProductInfoWindow.Cancelling });
        }
      },
    });

    kendo.bind($(self._productInfoWindowId + ' ' + '#tabInventoryControl'), self._productInfoDetailsViewModel);

    try {
      let result = await self._getMvvmData(self._inventoryId, self._productId, self._supplierId);
      self._productInfoDetailsViewModel.products.read();

      self._productInfoDetailsViewModel.set('value', result);

      if (result.UnitsOnOrderAfterLeadtime === true) {
        if ($(self._productInfoWindowId + ' ' + '#valueUnitsOnOrder').data('kendoNumericTextBox')) {
          let widget = $(self._productInfoWindowId + ' ' + '#valueUnitsOnOrder').data('kendoNumericTextBox');
          widget.wrapper.find('input').addClass('lightRed');
        }
      }

      if ($(self._productInfoWindowId + ' ' + '#minLevelParameterId').data('kendoNumericTextBox')) {
        $(self._productInfoWindowId + ' ' + '#minLevelParameterId')
          .data('kendoNumericTextBox')
          .min(result.MinLevelDefault);
      }
      if ($(self._productInfoWindowId + ' ' + '#maxLevelParameterId').data('kendoNumericTextBox')) {
        $(self._productInfoWindowId + ' ' + '#maxLevelParameterId')
          .data('kendoNumericTextBox')
          .min(result.MinLevelDefault);

      }

      var validator = $(self._productInfoWindowId).kendoValidator().data('kendoValidator');
      validator.validate();
      let element = $(self._productInfoWindowId);
      window.kendo.ui.progress(element, false);

    } catch ([jqXHR, textStatus, errorThrown]) {
      displayAjaxError(jqXHR, textStatus, errorThrown);
      productInfoDetailsViewModel.set('value', []);
      window.kendo.ui.progress(element, false);
    }
  }
}


Solution 1:[1]

Saving edits in product info modal deletes used filters on products grid

    if (productNo === null) {
        let newFilter = await self._getFilterOnlyFromLocalStorage();
        let totalFilter = $(self._gridId).data("kendoGrid").dataSource.filter();
        totalFilter.filters.push.apply(totalFilter.filters, newFilter.filters);
        $(self._gridId).data("kendoGrid").dataSource.filter(newFilter);

        self._setPredefinedFilterButton(self);
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Priyakolukuluri Kolukuluri