igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

IgxBooleanFilteringOperand doesn't work if the operation 'all' is localized(modified).

Open gdayori opened this issue 8 years ago • 3 comments

Description

IgxBooleanFilteringOperand doesn't work if the operation 'all' is localized(modified).

This is because 'all' is hardcoded at: https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/grid/grid-filtering.component.ts#L193 https://github.com/IgniteUI/igniteui-angular/blob/master/projects/igniteui-angular/src/lib/grid/grid-filtering.component.ts#L312

  • igniteui-angular version: 6.1.0
  • browser: Chrome

Steps to reproduce

  1. Localize strings in filtering operands like this constructor() { IgxStringFilteringOperand.instance().operations.forEach(operation => operation.name = this.localizeFilteringString(operation.name)); IgxDateFilteringOperand.instance().operations.forEach(operation => operation.name = this.localizeFilteringString(operation.name)); IgxBooleanFilteringOperand.instance().operations.forEach(operation => operation.name = this.localizeFilteringString(operation.name)); IgxNumberFilteringOperand.instance().operations.forEach(operation => operation.name = this.localizeFilteringString(operation.name));

}

localizeFilteringString(targetString: string): string { let result: string = targetString; switch (targetString) { case 'contains': result = '含む'; break; case 'doesNotContain': result = '含まない'; break; case 'all': result = '全て'; break; default: break; } return result; }

  1. Run the app and filter by 'true' in a boolean column.
  2. Filter by '全て'(means 'All' in this case) in the same boolean column.

Result

Can't filter by 'All'

Expected result

Should be filtered by 'All'

Attachments

N/A

gdayori avatar Jul 20 '18 09:07 gdayori

A new property is added to IFilteringOperation, it's called 'label' and it should be used for localization instead of 'name'.

sstoyanovIG avatar Jul 24 '18 14:07 sstoyanovIG

This would be a breaking change. I suggest you just change the logic of the boolean filter to always select the first operand initially and not select the 'all' by name. This would filter by a custom filtering operand if such is put first, but that just needs to be documented.

kdinev avatar Jul 25 '18 07:07 kdinev

@kdinev - I don't think this would be a breaking change for the majority of people. The name and label properties have same value by default. The label property is used only in the UI. In the filtering component there is a special logic which handles all - if all is selected we want to remove all filters instead of applying them. This would be a breaking change for anyone who tried to localize those filtering operands, but I don't think someone already did that (Except Satoru who apparently is evaluating this possibility). We will document the new label property and will add a sample how those filtering operands could be localized. I think having separate properties for id (name in our case) and label is the proper way to do this. And this will give us and our clients more flexibility when using those filtering operands.

bkulov avatar Jul 25 '18 11:07 bkulov