Multiple filters on same field not working

4 posts, 0 answers
  1. Martin
    Martin avatar
    1 posts
    Member since:
    Aug 2014

    Posted 31 Oct 2014 Link to this post

    Filtering a kendo dataSource connected to everlive doesn't seem to work if you have a two filters on the same field/column like this:

    [
       {field: "State", operator: "neq", value:"active"},
       {field: "State", operator: "neq", value:"new"}
    ]

    This gets translated to an everlive filter that looks like this: X-Everlive-Filter:{"State":{"$ne":"new"}}

    Seems like the first filter gets ignored. Using multiple filters on different fields works though.

    Doing this on a normal kendo datasource (not everlive) works fine.

    Am I doing something wrong or is this a bug?
  2. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 03 Nov 2014 Link to this post

    Hello Martin,

    Thank you for reporting this. I can confirm that this is a bug in the "Everlive" dialect of the Kendo UI Data Source that will be addressed.

    I updated your Telerik Points as a token of gratitude for your valuable input.

    Let me know should you have any further questions or suggestions.

    Regards,
    Anton Dobrev
    Telerik
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
  3. Martin
    Martin avatar
    1 posts
    Member since:
    Jul 2014

    Posted 02 Jan 2015 in reply to Anton Dobrev Link to this post

    Any news for this bug? Do you know when it will be fixed?
  4. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 06 Jan 2015 Link to this post

    Hi Martin,

    Thank you for getting back to us.

    The bug is logged in our issue tracking system and will be addressed. However, at the current stage we cannot commit to a particular time-frame for the fix.

    As a workaround I can suggest that you pass the filter to the transport.read.beforeSend configuration of the data source. Actually this is the configuration setting of the underlying AJAX request executed by jQuery.

    You can also modify the request before creating, updating or deleting items.

    For example:
    var filterExpression = {
        "$and": [{
            "field1": {
                "$ne": "active"
            }
        }, {
            "field1": {
                "$ne": "new"
            }
        }]
    };
     
    var dataSource = new kendo.data.DataSource({
        type: 'everlive',
        transport: {
            typeName: 'Activities',
            read: {
                beforeSend: function(xhr) {
                    xhr.setRequestHeader('X-Everlive-Filter', JSON.stringify(filterExpression));
                }
            }
        },
        schema: {
            model: {
                id: Everlive.idField
            }
        }
    });

    Thus you will be able to use a multiple filter on the same field.

    I hope that this will be helpful for you.

    Regards,
    Anton Dobrev
    Telerik
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
Back to Top