Hi,
As the current column filters are limited to "This Month" and "This Year", is there a way to filter a igx-grid based on weekly? For example, "This Week" or "Next Week". Is this filtering customizable, eg: show/hide filters?
Thanks!
Thanks Victor for your fast response and support. I'll try it out once more and will let you know if there is any update. Anyhow, thanks for your answers!
Hello Afif,
I have created a sample trying to reproduce the described behavior. I am using 11.0.7 version of Ignite UI for Angular package and 11 version of Angular. On my side everything works as expected and the custom filters are appeared in the filtering drop-down.
In order to be able to assist you further I will need some additional information regarding your scenario. Could you please try to modify the sample I have been attached, so that it replicates the issues you are facing and send it back to me? Alternatively, if the behavior cannot be replicated, please feel free to provide your own isolated sample, where the issue is reproducible. Please keep in mind to remove any dependencies and code that is not directly related to the issue.
Having a sample, which I can debug on my side, will be highly appreciated and extremely helpful for providing you with solution as soon as possible.
Thank you for your cooperation.
Looking forward to hearing from you.
Regards,Viktor KombovEntry Level Software DeveloperInfragistics, Inc.
Hi, thanks for your comprehensive answers. However, I've implement exactly as your solution but nothing happen on the UI. I thought it was because of the cache, but I've checked and confirmed.
This is the extended IFilteringOperation
The output UI:
For your reference, I'm using Angular 11.0.4 and @infragistics/igniteui-angular: 11.0.7`
Please let me know if you're need more information or have any idea regarding my issue.
Hello ,
Thank you for posting in our community.
You can customize the filtering menu by adding, removing or modifying the filtering operands. By default, the filtering menu contains certain operands based on the column’s data type (IgxBooleanFilteringOperand, IgxDateFilteringOperand, IgxNumberFilteringOperand and IgxStringFilteringOperand). You can extend these classes or their base class IgxFilteringOperand to change the filtering menu items’ behavior as in the following example:
HTML
<igx-column field="OrderDate" header="Order Date" [dataType]="'date'" [filters]="dateFilteringOperand"> </igx-column>
TYPESCRIPT
export class MyComponent implements OnInit { ... public dateFilteringOperand = DateTimeFilteringOperand.instance(); ... } export class DateTimeFilteringOperand extends IgxDateFilteringOperand { protected constructor() { super(); const thisWeek = { name: 'This Week', isUnary: true, iconName: 'this-week', logic: (target: Date) => { if (!target) { return false; } this.validateInputData(target); const targetDate = IgxDateFilteringOperand.getDateParts(target, 'yMd'); const now = IgxDateFilteringOperand.getDateParts(new Date(), 'yMd'); const today = new Date(); const diff = 7 - today.getDay(); const endOfWeek = today.getDate() + diff; const beginningOfWeek = endOfWeek - 6; return targetDate.year === now.year && targetDate.month === now.month && targetDate.day >= beginningOfWeek && targetDate.day <= endOfWeek } } let index = this.operations.indexOf(this.condition('yesterday')); this.operations.splice(index, 0, thisWeek); } }
More about IgxGrid's Custom Filtering Operands you can find here.
Additionally, I have created a small sample illustrating my suggestion, which you can find here. Please test it on your side and let me know whether you find it helpful.