We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Filtering date js

Thread ID:

Created:

Updated:

Platform:

Replies:

119469 Jun 25,2015 10:25 AM Jun 26,2015 07:48 AM ASP.NET MVC 1
loading
Tags: Grid
David
Asked On June 25, 2015 10:25 AM

Hi!

We need filter grid in side client but we can to do run.

We have a Hierarchy Grid and we try apply filter:

function filterDate(btnStatus)
    {
       
        // AÑADIR FILTROS DE FECHAS
        //filterGrid("FechaPrevista", "28/06/2015", btnStatus.isChecked, ej.FilterOperators.greaterThan);

        $.each(gridsChild, function (s, e) {
            var gridId = "#" + e;
            var gridObj = $(gridId).data("ejGrid");
            gridObj.model.filterSettings.filteredColumns = [];
            gridObj.refreshContent();


            var date = new Date(2015, 06, 15, 0, 0, 0, 0);
            //var dateDouble = date.getTime();
            gridObj.filterColumn("FechaPrevista", ej.FilterOperators.greaterThan, date, "or");

            onCreateRowChildres(e);
        });
        
    }

But never filter date... i attach project sample.

Thanks!

Attachment: TestSyncFusion_511fd772.zip

Ajith R [Syncfusion]
Replied On June 26, 2015 07:48 AM

Hi David,

Thanks for using Syncfusion products.

Query: We need filter grid in side client but we can to do run. But never filter date

We have analyzed your code snippet and found that you have not set the match case parameter value in the filterColumn function which is the cause of the issue. When the filterColumn function doesn’t have the match case parameter for filtering date type column, it will compare the date value as string and return the result based on the string value. So we suggest you to set the match case as true in the filterColumn function to resolve the issue.

Please refer the below code snippet for further details.


function filterDate(btnStatus)

    {            

        $.each(gridsChild, function (s, e) {

            -------

            -------

            var date = new Date(2015, 06, 15, 0, 0, 0, 0);           

            gridObj.filterColumn("FechaPrevista", ej.FilterOperators.greaterThan, date, "and", true);           

        });

       
    }


Note: Since you have set month value as 06 in the Date object, its corresponding month is July from javascript Date object and the filter result will show “No records to display” as per your records in the Grid.

Please refer the below link to know further  details about month in javascript object.

https://msdn.microsoft.com/library/cd9w2te4(v=vs.94).aspx

For your convenience we have modified your sample and the same can be downloaded from the below link.

Sample Link: http://www.syncfusion.com/downloads/support/forum/119469/ze/TestSyncFusion-520701269

Please let us know if you have any concerns.

Regards,
Ajith R

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;