blank $filter being passed in datasource

5 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    57 posts
    Member since:
    Jun 2012

    Posted 08 Jun 2012 Link to this post

    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?
  2. Jonathan
    Jonathan avatar
    57 posts
    Member since:
    Jun 2012

    Posted 12 Jun 2012 Link to this post

    Anyone have a solution?
  3. Kendo UI is VS 2017 Ready
  4. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 13 Jun 2012 Link to this post

    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!
  5. Jonathan
    Jonathan avatar
    57 posts
    Member since:
    Jun 2012

    Posted 13 Jun 2012 Link to this post

    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. 
  6. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 18 Jun 2012 Link to this post

    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!
Back to Top
Kendo UI is VS 2017 Ready