Kendo Grid - oData - web interface for the web server, filtering - decimal type

I installed a kendo grid with the following:

  • ASP.NET Web API with oDataController for reading data using oData formats.
  • Kendo grid with oData data source with server-side swapping, filtering and sorting.

Everything works fine as expected, except that filtering doesn't work with a decimal type column. When using filtering in a decimal column, kendo generates a URL with the following filter value:

$filter=Value gt 0.5

The web API returns a Bad Request with the following:

{
  "odata.error":{
    "code":"","message":{
      "lang":"en-US","value":"A binary operator with incompatible types was detected. Found operand types 'Edm.Decimal' and 'Edm.Double' for operator kind 'GreaterThan'."
    }
  }
}

URL "M" 0.5, , . -, -API oData , decimal, double, datetime, URL- : http://microliteorm.wordpress.com/2013/09/06/webapi-odata-filtering/

, "". double, decimal, integer .. Kendo (.. Double, decimal ..) URL- "". , datetime. .

EDIT: ( β„– 6) oData, , URI - http://www.odata.org/documentation/odata-version-2-0/overview/

+4
2

Kendo , int, float decimal. JavaScript . Kendo number , , .

, 0.5 0.5m . Kendo UI DataSource .

var ds = new kendo.data.DataSource({
  transport: {
    //...other implementation details removed for brevity
    parameterMap: function(data, type) {
      if (type === 'read') {
        //...covert decimal values in the `data.filter` to strings ending with 'm'
      }
    }
  }
});
+1

, , , , , , . ODATA, . , , , FilterDescriptor. , .

0

All Articles