Search code examples
javascriptdatasourcedevextreme

DevExtreme - ODataStore Url


I have an ODataStore:

var storeUsers = new DevExpress.data.ODataStore({
    type: "odata",
    jsonp: false,
    url: SERVICE_URL,
    key: "FEATID",
    keyType: "Int32"
});

The db is Oracle and FEATID is of Number(38) datatype. The ODataStore is used in a dxDataGrid. When I update or remove a row of the dxDataGrid I always have the error of Bad request, error in query syntax. After a bit of research I found out that the problem is the url, at the moment if the keyType is Int32 the url is

http://.../DataService.svc/PX_USERS(7)

if I change the keyType to Int64 then the url becomes

http://.../DataService.svc/PX_USERS(7L)

But for my db, in order to work, the url should be:

http://.../DataService.svc/PX_USERS(7M)

but I have no idea how to change the url. I tried to statically add an M to the column, but then it becomes a String and it is still wrong..


Solution

  • If your OData requires a key with "M", the key type is Decimal. See the Primitive Data Types OData help topic. So, set the keyType option to 'Decimal' to resolve the issue.

    var storeUsers = new DevExpress.data.ODataStore({
        type: "odata",
        jsonp: false,
        url: SERVICE_URL,
        key: "FEATID",
        keyType: "Decimal"
    });