Calculate filter value based on date column value by day, week and month

Hi Syncfusion Team

I have a requirement that uses external button to do custom filtering on a date field using filterByColumn method. example: grid.filterByColumn('time','LessThanOrEqualTo', 86400000)

However, the date value returned from the server is in date iso string (2021-10-22T11:11:11.111Z). I need to convert the date value to milliseconds and perform certain calculation before triggering the filter function.

is there any way to do process the data before filtering without modifying the original data?


Regards

Amanda


1 Reply

RR Rajapandi Ravi Syncfusion Team October 22, 2021 01:07 PM UTC

Hi Amanda, 

Greetings from Syncfusion support 

From your update we could see that you like to perform some calculation for date value before filtering. By default, when we start the Grid actions such as sorting, filtering, paging, grouping… the actionBegin event gets triggered.  So, when you are performing the filter action the actionBegin event gets triggered. In this event you can access the filter related properties. If you like to perform calculation before filtering, we suggest you do it in a actionBegin event. Please refer the below code example for more information. 

 
actionBegin: function (args) { //actionBegin event of Grid 
    if(args.requestType == 'filtering' && args.action == 'filter') { 
        //perform your calculation here 
    } 
  } 
 


Before we start providing solution on your query, we need some information for our clarification. Please share the below details that will be helpful for us to provide better solution. 

1)           Please share the details about what type of data you are bounding to the Grid. Share your sample datasource type we would like to see at what format you are maintaining value for the date column. 

2)           Please share the details about why you are giving Json date string value (86400000) in filterByColumn() method. Please share your exact requirement with detailed description. 

Regards, 
Rajapandi R 


Loader.
Up arrow icon