How to use the odata.count function in odata

To help you get started, we’ve selected a few odata examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github KleeGroup / focus-core / lib / helpers / odata_helper.js View on Github external
function parseOdataResponse(response) {
    if (response === undefined || response === null) {
        throw new Error('Odata error : parsing result');
    }
    // To be comaptible with C# ODataController
    _.extend(response, utilHelper.flatten({
        odata: response.odata
    }));
    delete response.odata;
    if (response["odata.count"] === undefined || response["odata.count"] === null) {
        throw new Error('Odata error : parsing result');
    }
    return {
        totalRecords: response["odata.count"],
        values: response.value
    };
}
github KleeGroup / focus-core / lib / helpers / odata_helper.js View on Github external
function parseOdataResponse(response) {
    if (response === undefined || response === null) {
        throw new Error('Odata error : parsing result');
    }
    // To be comaptible with C# ODataController
    _.extend(response, utilHelper.flatten({
        odata: response.odata
    }));
    delete response.odata;
    if (response["odata.count"] === undefined || response["odata.count"] === null) {
        throw new Error('Odata error : parsing result');
    }
    return {
        totalRecords: response["odata.count"],
        values: response.value
    };
}
github unosquare / tubular / dist / tubular-odata-bundle.js View on Github external
var promise = response.promise.then(function (data) {
                        var result = {
                            Payload: data.value,
                            CurrentPage: 1,
                            TotalPages: 1,
                            TotalRecordCount: 1,
                            FilteredRecordCount: 1
                        };

                        result.TotalRecordCount = parseInt(data['odata.count']);
                        result.FilteredRecordCount = result.TotalRecordCount; // TODO: Calculate filtered items
                        result.TotalPages = parseInt((result.FilteredRecordCount + params.Take - 1) / params.Take);
                        result.CurrentPage = parseInt(1 + ((params.Skip / result.FilteredRecordCount) * result.TotalPages));

                        if (result.CurrentPage > result.TotalPages) {
                            result.CurrentPage = 1;
                            request.data = params;
                            request.data.Skip = 0;

                            request.serverUrl = originalUrl;

                            me.retrieveDataAsync(request).promise.then(function (newData) {
                                result.Payload = newData.value;
                            });
                        }
github xautlx / s2jh4net / entdiy-assets / src / main / resources / META-INF / resources / assets / apps / plugins / free-jqgrid / plugins / grid.odata.js View on Github external
total: function (data) {
                                    var total = data["odata.count"] || data["@odata.count"];
                                    return Math.ceil(total / p.rowNum);
                                },
                                userdata: "userdata"
github KleeGroup / focus-core / dist / browser / fmk.js View on Github external
function parseOdataResponse(response) {
        if (response === undefined || response === null || response["odata.count"] === undefined || response["odata.count"] === null) {
            throw new Error('Odata error : parsing result');
        }
        return {
            totalRecords: response["odata.count"],
            values: response.value
        };
    }
github spatools / spatools / spa / data / adapters / odata.ts View on Github external
private fixResult(result: any): adapters.IAdapterResult {
        var data = result,
            count = -1;

        if (result["odata.metadata"]) {
            if (result["odata.count"])
                count = result["odata.count"];

            data = result.value;
        }
        else if (!query) {
            count = result.length;
        }

        return {
            data: data,
            count: count
        };
    }
    private ajax(url: string, type: string = "GET", data?: any): JQueryPromise {
github senpaiski / TopAnimeStream / public / js / controllers.js View on Github external
.then(function (data) {
                
                $scope.totalAvailableEpisodes = data["odata.count"];

                for (var i = 0; i < data.value.length; i++) {
                    $scope.episodes.push(data.value[i]);
                }

                $scope.boolBusy = false;
            });
    }
github spatools / spatools / spa / data / relationview.ts View on Github external
.then(function (data) {
                    if (data["odata.metadata"]) {
                        if (data["odata.count"])
                            count = data["odata.count"];

                        data = data.value;
                    }
                    else if (data.__count) {
                        count = data.__count;
                        data = data.results;
                    }
                    else if (!query) {
                        count = data.length;
                    }

                    return data;
                })
                .then(function (data) {
github spatools / spatools / spa / data / dataset.ts View on Github external
.then(function (data) {
                if (data["odata.metadata"]) {
                    if (data["odata.count"])
                        count = data["odata.count"];

                    data = data.value;
                }
                else if (data.__count) {
                    count = data.__count;
                    data = data.results;
                }
                else if (!query) {
                    count = data.length;
                }

                return data;
            })
            .then(function (data) {

odata

o.js is a isomorphic Odata Javascript library to simplify the request of data. The main goal is to build a standalone, lightweight and easy to understand Odata lib.

MIT
Latest version published 3 months ago

Package Health Score

76 / 100
Full package analysis