Handsontable: We should consider adding a method that does the same as conditionsCollection to public API

Created on 7 May 2019  路  1Comment  路  Source: handsontable/handsontable

Description


Mentioned by @aaronbeall at https://forum.handsontable.com/t/what-happened-to-the-filter-plugin-members-documentation/3227

Your environment

  • Handsontable version: 7.0.1
  • Browser Name and version: n/a
  • Operating System: n/a
Filtering Feature

Most helpful comment

This would help. Something like filtersPlugin.getConditions() which returns a conditions stack that looks like what's passed to afterFilter.

A related request would be a way to set the conditions. Right now the only way is to call addCondition but this only adds a single condition, whereas the "conditions stack" is basically a 2d collection, so to set the conditions (say saved from local storage or a preset) we have to:

filtersPlugin.clearConditions();

for (let i = 0; i < conditionsStack.length; i++) {
  const columnConditions = conditionsStack[i];
  for (let j = 0; j < columnConditions.conditions.length; j++) {
    const condition = columnConditions.conditions[j];
    filtersPlugin.addCondition(columnConditions.column, condition.name, condition.args, columnConditions.operation);
  }
}

It would be a lot more convenient and intuitive if we could just pass the stack:

filtersPlugin.setConditions(conditionsStack);

>All comments

This would help. Something like filtersPlugin.getConditions() which returns a conditions stack that looks like what's passed to afterFilter.

A related request would be a way to set the conditions. Right now the only way is to call addCondition but this only adds a single condition, whereas the "conditions stack" is basically a 2d collection, so to set the conditions (say saved from local storage or a preset) we have to:

filtersPlugin.clearConditions();

for (let i = 0; i < conditionsStack.length; i++) {
  const columnConditions = conditionsStack[i];
  for (let j = 0; j < columnConditions.conditions.length; j++) {
    const condition = columnConditions.conditions[j];
    filtersPlugin.addCondition(columnConditions.column, condition.name, condition.args, columnConditions.operation);
  }
}

It would be a lot more convenient and intuitive if we could just pass the stack:

filtersPlugin.setConditions(conditionsStack);
Was this page helpful?
0 / 5 - 0 ratings