Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
135
Igx angular grid remote filtering with date picker value is not able to read
posted

I am implementing server side filtering (Remote filtering) for Igx grid. When I try to filter a date column with date time picker with below options are not working

Only below options are working

While I was checking with filter expression  I am getting searchVal as null in case of date picker options which are not working.for ex:Today,Yesterday,Last month,Next month etc.

I followed below link to implement remote filtering

https://ko.infragistics.com/products/ignite-ui-angular/angular/components/grid/remote-data-operations#angular-grid-remote-data-operations-overview-example

Can you please help me to resolve date filter issue

Top Replies

  • 460
    Offline posted

    Hello Roopesh,

    I have been looking into your question and the described behavior is due to the fact that, as you can see, the given documentation sample provides guidelines and ways to implement remote filtering and shows an igx-grid component with string and number columns and redefining conditional cases to match these columns remote data.

    switch (operand.condition.name) {
                    case 'contains': {
                        filterString = `${FILTER_OPERATION.CONTAINS}(${fieldName}, ${filterValue})`;
                        break;
                    }
                    case 'startsWith': {
                        filterString = `${FILTER_OPERATION.STARTS_WITH}(${fieldName},${filterValue})`;
                        break;
                    }
                    case 'endsWith': {
                        filterString = `${FILTER_OPERATION.ENDS_WITH}(${fieldName},${filterValue})`;
                        break;
                    }
                    case 'equals': {
                        filterString = `${fieldName} ${FILTER_OPERATION.EQUALS} ${filterValue} `;
                        break;
                    }
                    case 'doesNotEqual': {
                        filterString = `${fieldName} ${FILTER_OPERATION.DOES_NOT_EQUAL} ${filterValue} `;
                        break;
                    }
               }

    However, each user has his custom logic and custom remote data, so remote filtering is customized according to the custom data to match the given values. If your data with dates is in string format, you will add new cases of conditions for string dates, if it is another format, it must be adjusted again according to the custom logic. Therefore, what you need to do is to add new condition cases for the given filters: Today,Yesterday,Last month,Next month etc. according to your remote data. Then, when filtering, the values can be matched with this data.

                   case 'today':{
                    }
                    case 'yesterday':{
                    }
                    case 'lastMonth':{
                    }
                    case 'nextMonth':{
                    }

    With the given filter conditions Today,Yesterday,Last month,Next month etc. search value - searchVal is expected to be null because you do not choose a value from the datapicker, but automatically apply today, yesterday and so on.

    In addition, I have prepared small sample with guidelines which could be found here. You need to add the given conditions according to your custom remote data. If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce, with your custom logic and custom remote data. Alternatively, if the behavior cannot be replicated, please feel free to provide your own isolated sample.

    Having a working sample on my side with your specific custom logic, remote data and filtering, which I can debug, is going to be very helpful. 

    If you require any further assistance on the matter, please let me know.

    Regards,

    Georgi Anastasov

    Entry Level Software Developer

    Infragistics

  • 135
    Offline posted

    Only below options are working