Hi,
I need to filter the date column of an Ignite UI Grid programmatically. I've been able to get it working for a single date, but I also need to programmatically filter it by a range, such as Last Week, or Last Month, but I haven't seen an forum posts or anything in the documentation that has been able to help this issue.
The filtering I need is the same as the filters that are offered in the dropdown, but needs to also be filtered by Last Week, or a custom date range.
If someone could either point me to an existing post that shows this functionality or offer a sample of code that would be great. Thanks!
Hello Pete,
Thank you for contacting Infragistics.
You can use the advanced filtering mode. It allows filtering same row in multiple using different conditions and you would also allow you to add custom filtering conditions like last week. You can achieve this by changing mode to advanced.
Additionally, currently the grid already supports filtering of last month out of the box. You can select only few filtering conditions using the conditionList option.
features: [ { name: 'Filtering', mode: 'advanced', columnSettings: [ { columnKey: 'Date', condition: 'on', conditionList: ['on', 'before', 'after', 'lastMonth', 'lastWeek'], editorType: 'datepicker', customConditions: { lastWeek: { labelText: "Last Week", expressionText: "lastWeek", requireExpr: false, filterFunc: function() { // Add filtering logic for last week condition. } }, } } ] } ]
I have attached a sample on how this solution would work.
advancedFilteringDataColumnSample.zip