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

blank $filter being passed in datasource

4 Answers 100 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 08 Jun 2012, 05:30 PM
I have a case where the datasource object is passing a blank $filter param. When using the MVC4 RC Web-api it throws an error because the filter is blank. 

Here is a sample URL the datasource is calling:
http://localhost:3046/api/clients?%24inlinecount=allpages&%24format=json&%24top=50&%24filter=

What appears to be happening is that it only adds the blank filter if I clear out the search criteria  (right now I just have this bound to a combo box). So when I type in something to the combo, it makes the call to the server, filters correctly. But if I clear that, it will pass a blank filter.

How can I intercept that to make sure it isn't even passing the filter?

4 Answers, 1 is accepted

Sort by
0
Jonathan
Top achievements
Rank 1
answered on 13 Jun 2012, 03:13 AM
Anyone have a solution?
0
Alexander Valchev
Telerik team
answered on 13 Jun 2012, 04:14 PM
Hello Jonathan,

We are not aware of such behaviour and I am afraid that the information you provided is not sufficient enough to determine where the problem comes from. I tried to reproduce this issue using this demo, but to no avail. Is it possible for you to send me a small but runnable project that demonstrates the problem. Please provide such example and I will check it right away.

Greetings,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jonathan
Top achievements
Rank 1
answered on 13 Jun 2012, 08:03 PM
This is essentially how the data sources are defined:
   ds = new kendo.data.DataSource(
            {
                transport: {
                    read: { url: "/api/" + entityset },
                    destroy: { url: "/api/" + entityset + "/delete" },
                    update: { url: "/api/" + entityset },
                    parameterMap: kendo.data.transports.odata.parameterMap,
 
                    cache: true,
                    dataType: "json"
                },
                schema: {
                    id: "id"
                },               
                
                serverFiltering: true//,
//                serverPaging: true,
//                pageSize: 50
            });


The main difference is the parameterMap from the demo. 
0
Alexander Valchev
Telerik team
answered on 18 Jun 2012, 09:39 AM
Hello Jonathan,

There are a few issues in your code snippet, however I do not think that they are the cause of described behaviour. As a general information the id is property of the model and dataType & cashe are configuration options of the transport methods (read, update, etc.).
Since I am still unable to reproduce the problem in question, I kindly ask you to provide a small but runnable project that will allow me to test your case locally. Could you please confirm what version of the framework / jQuery you are using and if the issue occurs in specific browser or not.

Meanwhile in order to avoid the problem, you can define your own parameter map function, modify manually the options object and call the default oData parameter map from within your function.

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Data Source
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Jonathan
Top achievements
Rank 1
Alexander Valchev
Telerik team
Share this question
or