Issue with AngularJS ngGrid rendering incorrect page size and malfunctioning pagination

I'm currently working on implementing ngGrid data pagination for some data retrieved from a service. The table displays correctly and the search filter is functional. However, despite setting the pageSize in my pagingOptions to 25, the table shows all of the data at once. Additionally, when I navigate through the pagination buttons, I encounter an issue where the data disappears around page 3 out of 6 and the pagination display switches to showing page 3 out of 1. I would greatly appreciate any assistance with this, code snippet provided below:

var drilldownDirective = function() {
    return {
        restrict: 'E',
        scope: {
            tableData: '=',
            numPages: '@'
        },
        controller: function($rootScope, $scope, DashboardFactory) {
            var tableData = $scope.tableData;
            var dashboardreportid = tableData.dashboardreportid;
            var companyid = tableData.companyid;
            var companybrandid = tableData.companybrandid;
            var startdate = tableData.startdate;
            var enddate = tableData.enddate;
            var clientdb = tableData.clientdb;
            var calltype = tableData.calltype;
            var secondarycallval = tableData.secondarycallval;
            $scope.gridData = [];

            var onSuccess = function(response) {
                var d, t, dt, dtobj, obj;
                $scope.repdata = [];
                $scope.titles = [];

                for (d in response.repdata) {
                    var dtArray = {};

                    obj = response.repdata[d];
                    $scope.repdata.push(obj);

                    for (var d in obj.data) {
                        var fieldName = d.split(" ").join("_");
                        var val = obj.data[d];
                        dtArray[fieldName] = val;
                    }

                    //push new created object to gridData array
                    $scope.gridData.push(dtArray);
                }
            };

            var onError = function(response) {
                console.log("error");
                console.log(data);
            };

            DashboardFactory.getDashboardReportData(dashboardreportid, companyid, companybrandid, startdate, enddate, clientdb, calltype, secondarycallval).then(onSuccess, onError);

            //ngGrid options
            $scope.filterOptions = {
                filterText: "",
                useExternalFilter: true
            }; 

            $scope.totalServerItems = 0;
            $scope.pagingOptions = {
                pageSizes: [10, 25, 50, 100],
                pageSize: 25,
                currentPage: 1
            };  

            $scope.getPagedDataAsync = function (pageSize, page, searchText) {
                setTimeout(function () {    
                    if (searchText) {};
                    $scope.setPagingData($scope.gridData, page, pageSize);
                }, 100);
            };

            ...

            $scope.gridOptions = {
                data: 'gridData',
                showFilter: true,
                enablePaging: true,
                totalServerItems: 'totalServerItems',
                pagingOptions: $scope.pagingOptions,
                plugins: [new ngGridCsvExportPlugin(), new ngGridFlexibleHeightPlugin()],
                showFooter: true,
                jqueryUITheme: true,
                filterOptions: $scope.filterOptions
            };
        },
        templateUrl: "dashboard/drilldownTable.html",
    }
}

Answer №1

If you're experiencing issues with ngGrid, consider giving ngTasty a try instead. You can access it at . It may prove to be a more user-friendly option, and I am willing to assist you if any problems arise.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Executing functions within express - a mystery

I am struggling with a back-end JavaScript issue in Express. For some reason, when I call my function, it is returning undefined. Here's how it looks: // express route structure: exports.check = function(req, res) { // check if the username is prese ...

Creating a Cordova application from the ground up, evaluating the options of using ngCordova, Ionic framework, and

With the goal of creating a multiplatform Cordova app for Android, iOS, and Windows, I have been exploring different approaches. My plan is to build an application with 4 or 5 features focused on service consumption (listing, adding, and editing items) wh ...

Transforming an array of strings into a visual representation

Having an issue parsing a string array for Highcharts consumption. The chart renders when values are static, but not when passed as an array. I have validated the string being parsed here. The main issue appears to be with this specific line: //This work ...

Activate the Giphy search feature in the Slack Nestor bot's response

How can the nestor bot be configured to use a giphy search when replying in a Slack channel where the giphy plugin is active? Can something like msg.reply('/giphy ' + text, done); be used for this purpose? ...

Using V-bind to assign multiple classes has never been easier

Is there a way to assign one of two classes to an element based on three possible input variables in my Vue.js code? <input type='text' class='inputwordtext' v-bind:class="{(wordupload.firstchoice.selected == 'Zinnenlijst' ...

HTML elements not displaying in Ajax form

I am encountering an issue with my ajax based feedback form where the form is displaying the html from the response instead of processing it correctly. Here is the JQuery code: $(document).ready(function() { var form_holder = $('#form-holder'); ...

Unable to successfully interact with Paypal button using selenium automation

I'm facing an issue with Selenium where I am unable to click on the PayPal button. https://i.sstatic.net/Xx62H.png https://i.sstatic.net/lZg88.png Despite trying various methods recommended in the Selenium documentation, the button remains unrespon ...

What are the recommended guidelines for using TypeScript effectively?

When facing difficulties, I have an array with functions, such as: this._array = [handler, func, type] How should I declare this private property? 1. Array<any> 2. any[] 3. T[] 4. Array<T> What is the difference in these declarations? ...

Using the ng-click directive with checkboxes in Angular

Angular 1.2: <input type="checkbox" ng-model="vm.myChkModel" ng-click="vm.myClick(vm.myChkModel)"> The myClick function doesn't have the correct state? I'm trying to get the updated state after clicking. ...

AngularJS 1 scripts being compiled by Gulp in the wrong sequence

Have you ever encountered this issue before? Whenever I run my scripts through GULP, the console starts throwing errors, indicating that my directives and/or controllers are not being registered properly. To address this, I experimented by adding the app v ...

What could be causing the sluggishness of this ajax call?

After implementing an ajax function on the page load event, I noticed that there was no record of the call in the server log (which logs all entrance and exit points of all MVC server methods). The request from the JavaScript to the server was taking an un ...

Is it possible to programmatically include a getter method to a class in JavaScript or TypeScript?

My current focus is on TypeScript and I'm exploring the decorators functionality. I would greatly appreciate some guidance or expert knowledge on JavaScript capabilities in this area. I am curious about dynamically adding a getter method to a Prototy ...

What is the best way to only load a specific div from another webpage onto my own webpage without loading the entire page?

I am currently working with two webpages named internal.html and external.html Within internal.html, I have the following code snippet that loads external.html into a div with the id "result": <script src="http://ajax.googleapis.com/ajax/libs/jquer ...

When attempting to reload a single page application that utilizes AJAX, a 404 error is encountered

Recently, I've been working on coding my personal website and have successfully created a single page application using ajax. The content is dynamically loaded between the header and footer whenever a navigation bar link is clicked. To enable the back ...

What is the process for importing a sprite sheet along with its JSON file into my Phaser game?

Currently, I am in the process of developing a game using the powerful phaser game engine. To enhance the visual appeal of my game, I decided to create a sprite sheet and successfully downloaded it. The sprite sheet consists of a 256 × 384 .png file ...

What is the best way to create clickable text in an HTML string and set up an @click function in VueJS 2?

I have an array of strings that I want to transform by turning certain words like "User object", "Promise", etc into clickable links. Here is the initial array: var strings = ['This returns a promise containing a User Object that has the id', &a ...

What is the best way to clear the cache in AngularJS?

It is crucial for the cache to be cleared consistently. However, no matter if a client is created, updated, or deleted, the same result always occurs. Only when I manually delete the cache (Ctrl+Shift+Supr), am I able to view the new data. .factory(' ...

Using Bootstrap's nav-pills inside a table

Is there a way to incorporate Bootstrap Nav Pills into a table, with the "tab buttons" located in the last row of the table? I've attempted it but it doesn't seem to be functioning correctly. Check out this link for reference <table clas ...

Is there a way to modify the title of a website upon entering the webpage and then updating it when moving to a new page?

I'm encountering an issue with changing the website title during two specific processes. Upon entering a webpage, the title is modified using the following code: <script type="text/javascript"> $(document).ready(function() { docum ...

unable to gather information from suppliers

I'm currently building a login page with nextjs and spotify js, but I've run into the following error https://i.sstatic.net/cKiM8.png Here is the code snippet that is causing the issue: import React from 'react' import { getProviders ...