Search code examples
odatakendo-ui

Kendo grid filter + odata + Int64 field


I'm trying to filter data based on Int64 field from Kendo Grid, which uses Odata as service. Based from Odata specification, Int64 field require filter value to have an additional "L" at the end, like 666423361622L. So, I'm setting my kendo grid filter like:

{{ field: \"MyField\", operator: \"eq\", value: 666423361622L }}

, but this throws an error: SyntaxError: identifier starts immediately after numeric literal , showing at 666423361622L which it doesn't like. Is there a way I can format this, so it would work? If I use a value without L (666423361622), it throw exception on PraseInt function in my Odata service.


Solution

  • To solve this, I intercepted ajax request and modified data sent to ODATA service. Simply appended the "L" manually. Like this:

    $(document).ajaxSend(function (e, jqxhr, settings) {
        var re = /(FIELDNAMEFORINT64\+(eq|ge|le)\+(\d)*)/g;
        var found = settings.url.match(re);
    
        if (found) {                
           for (var i = 0; i < found.length; i++) {
               settings.url = settings.url.replace(found[i], found[i] + "L");
           }
        }            
    });