This is a migrated thread and some comments may be shown as answers.

Simpler server-filtering syntax?

4 Answers 156 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Brian Vallelunga
Top achievements
Rank 1
Brian Vallelunga asked on 18 Dec 2014, 09:12 PM
I'm looking at using a Data Source with server filtering turned on, but without odata. Is there a simpler URL syntax for filtering in a find-as-you-type scenario? Right now my URL for a filter of "c" looks like:

?filter%5Blogic%5D=and&filter%5Bfilters%5D%5B0%5D%5Bvalue%5D=c&filter%5Bfilters%5D%5B0%5D%5Bfield%5D=&filter%5Bfilters%5D%5B0%5D%5Boperator%5D=startswith&filter%5Bfilters%5D%5B0%5D%5BignoreCase%5D=true

Ideally, I'd like something along the lines of:

?filter=c

Is there an easy way to do this for use with the multi-select widget?

4 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 22 Dec 2014, 08:36 AM
Hi Brian,

Did you set the dataSource type to "odata"? In case you are not using odata please remove this setting from your configuration.

On a side note, to customize the parameters being send to the server you may use the parameterMap function of the dataSource.transport. In case you want to further customize the transport URL you may define it as a function. For more information please check the corresponding documentation:


Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Brian Vallelunga
Top achievements
Rank 1
answered on 30 Dec 2014, 03:03 PM
I am configuring the dataType to "json" but it is certainly using odata as the filter format.

var dataSource = new kendo.data.DataSource({
                serverFiltering: true,
                transport: {
                    read: {
                        dataType: "json",
                        url: "myurl"
                    }
                }
            });


0
Accepted
Petyo
Telerik team
answered on 01 Jan 2015, 11:06 AM
Hi,

this is the default filtering parameter construction for the datasource (not related to odata). You can change it in the parameterMap configuration, like Alexander pointed in his previous reply. 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Brian Vallelunga
Top achievements
Rank 1
answered on 12 Feb 2015, 02:11 AM
The parameterMap function worked great. I have the following code to pull our the filter value for a multi-select:

parameterMap: function(data, type) {
    if (type == "read" && data.filter) {
        return {
                   query: data.filter.filters[0].value
        }
    }
}
Tags
Data Source
Asked by
Brian Vallelunga
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Brian Vallelunga
Top achievements
Rank 1
Petyo
Telerik team
Share this question
or