- Home
- Forum
- JavaScript - EJ 2
- Grid filtering datetime predicate does not work
Grid filtering datetime predicate does not work
Hello,
I updated package from 17.4.43 to 18.1.54. Filtering in grid has stopped working with datetime. I have created a working example on stackblitz. Has something changed or is this a bug?
Thanks
SIGN IN To post a reply.
7 Replies
RR
Rajapandi Ravi
Syncfusion Team
May 27, 2020 10:26 AM UTC
Hi ssvinciak,
Greetings from syncfusion support
Based on your code example we found that you have used the “greaterthanorequal” operator in grid query property and used the date value as “2020-05-26T18:29:00.803Z”. But in your service we found that there is no date values are greater than your mentioned date value in grid query. So, we suspect that it causes the no records to display.
Please refer the below screenshot for more information.
Screenshot:
For your reference we have modify the date value in your sample and it works fine. Please refer the below code example sample and screenshot for more information.
|
const date = '1948-12-08T00:00:00Z';
let grid: Grid = new Grid(
{
dataSource: data,
allowPaging: true,
query: new Query().where('BirthDate', 'greaterthanorequal', new Date(date)),
columns: [
{ field: 'BirthDate', type:'date', format: 'yMd', headerText: 'Birth', textAlign: 'Right' },
],
pageSettings: { pageCount: 3 }
});
grid.appendTo('#Grid'); |
Screenshot:
Regards,
Rajapandi R
SB
sbartos
May 27, 2020 01:41 PM UTC
Hello,
Thanks for your reply. I forgot to mention that the variable date has to be a string because the filtering setting is saved in json. Therefore, I can't use new Date(...). It has worked before, but after the new upgrade, it has stopped. I have also tried other date formats such as '01/01/2020', but with no success.
TS
Thiyagu Subramani
Syncfusion Team
May 28, 2020 11:12 AM UTC
Hi ssvinciak,
Thanks for your update.
In your update you have mentioned that you cannot use new Date(...) option for value while generating query.
So, we suggest you to use the query after column model created in grid. For this we suggested you to use created event to achieve your requirement.
Please refer to the below code and sample.
|
const date = '1948-12-08T00:00:00Z';
let grid: Grid = new Grid(
{
. . . .
created: function (args) {
grid.query = new Query().where('BirthDate', 'greaterthanorequal', date)
},
columns: [
{ field: 'BirthDate', type: 'date', format: 'yMd', headerText: 'Birth', textAlign: 'Right' },
],
. . . . . . .
grid.appendTo('#Grid');
|
Sample link : https://stackblitz.com/edit/pyhlcq-mkthbt?file=index.ts
Reference link : https://ej2.syncfusion.com/documentation/api/grid/#created
In your update you also mentioned that it has been worked in previous version. So, we checked the attached sample with 17.4.43 version but still we face the same issue in the sample.
Please get back to us, if you need any further assistance.
Regards,
Thiyagu S
SB
sbartos
May 28, 2020 04:52 PM UTC
Hello,
Thank You for your answer.
The
demo on the sample link you have provided does not filter at all. You
can check it in the network console that the URL does not contain filter
condition at all.
I have tried to reproduce a working demo with 17.4.43, but I couldn't on stackblitz.
Here is an example with fitersettings, which I have used before in older version.
The problem is that it generates query like this:
https://services.odata.org/V4/Northwind/Northwind.svc/Employees?$count=true&$skip=0&$top=12&$filter=(BirthDate ge '2020-01-01T00:00:00.00Z')
And OData v4 handles it like a string because of the single quotes around the date. The right query should be like this:
https://services.odata.org/V4/Northwind/Northwind.svc/Employees?$count=true&$skip=0&$top=12&$filter=(BirthDate ge 2020-01-01T00:00:00.00Z)
So,
can you implement check whether the value is in ISO date format in
order to handle as a date, not as a string? Or can you provide another
solution?
SB
sbartos
June 3, 2020 11:58 AM UTC
Hello,
I have updated the sample. It fails to build with 17.4.43. All settings are identical. If it would build, it might have been working with datetime query.
The project has 2 branches. Please use the 17.4.43 branch.
RR
Rajapandi Ravi
Syncfusion Team
June 4, 2020 01:09 PM UTC
Hi ssvinciak,
Sorry for the inconvenience
After validating further with the source we have confirmed and logged this as a bug in the component.
We have considered “Grid filtering predicate does not work in new version” as a defect and logged a report for the same. We will include the defect fix in our upcoming June 24, 2020 patch release.
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
Feedback Link: https://www.syncfusion.com/feedback/14972/grid-filtering-predicate-does-not-work-in-new-version
Regards,
Rajapandi R
RR
Rajapandi Ravi
Syncfusion Team
July 13, 2020 11:58 AM UTC
Hi ssvinciak,
We are glad to announce that our Essential JavaScript2 patch release (v 18.2.44) has been rolled out successfully. In this release we have fixed the reported issue “Grid filtering predicate does not work in new version” in our 18.2.44 release. So kindly upgrade to our package version (18.2.44) to resolve the reported issue.
For your reference we have prepared a sample with our latest version (v 18.2.44). Please refer the below sample and screenshot for more information.
Screenshot:
Feedback Link: https://www.syncfusion.com/feedback/14972/grid-filtering-predicate-does-not-work-in-new-version
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
Regards,
Rajapandi R
SIGN IN To post a reply.
- 7 Replies
- 3 Participants
-
SB sbartos
- May 26, 2020 06:50 PM UTC
- Jul 13, 2020 11:58 AM UTC