How can I retrieve the page size of Syncfusion.Grid within an Angular application?

I am integrating Syncfusion into my Angular project. Whenever a paging event occurs, I need to retrieve the current page and page size of the grid. Below are the relevant code snippets:

component.html:

<ejs-grid #Grid class="data-grid" (recordDoubleClick)="onDoubleClick($event)" height="55vh" [dataSource]='dataSource'
            [allowPaging]="true" [allowResizing]="true" [allowSorting]="true" [allowFiltering]="true"
            [pageSettings]='pageSettings' (actionBegin)="onActionBegin($event)">
. . . .
. . . .
        </ejs-grid>

component.ts:

//For pagination handling
  @ViewChild("Grid") 
  public grid!:GridComponent;
  currentPage: number = 1;
  pageSize: number = 50;
  onActionBegin(e: any) {
    this.currentPage = this.grid.pagerModule.pagerObj.currentPage;  
    this.pageSize = this.grid.pagerModule.pagerObj.pagerdropdownModule.dropDownListObject.value
    console.log(this.pageSize)
  }

The issue arises when trying to access dropDownListObject, which results in an error message stating:

Property 'dropDownListObject' is private and only accessible within class 'PagerDropDown'.

How can I resolve this problem effectively?

(Related link)

Answer №1

The solution to this issue was found by implementing the code snippet below:

this.pageSize = this.grid.pagerModule.pagerObj.pageSize

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

Having trouble with sending values to Angular 7 components' HTML pages

Struggling with a simple task and encountering an error: Code snippet below: app.component.html <div class="col-md-{{myvalue}}">stuff here</div> app.component.ts myvalue: string; ngOnInit() { this.myvalue('6'); } Seeing th ...

Can TypeScript and JavaScript be integrated into a single React application?

I recently developed an app using JS react, and now I have a TSX file that I want to incorporate into my project. How should I proceed? Can I import the TSX file and interact with it within a JSX file, or do I need to convert my entire app to TSX for eve ...

My attempts to launch Angular using `npm run start-ssr` are being hindered by an error appearing in the console

I've been working on integrating Angular Universal into my Angular 7 app. I've managed to get it up and running with `npm run start-ssr`, but I'm encountering the following errors in my node console. Cannot find name require. Do you need to ...

Prevent touching the pseudo content of an element

My issue involves a toggle button component where I have utilized the ::before pseudo class to add text. The problem arises when clicking on the text within the toggle button causes the button's state to change. How can this be prevented? Here is the ...

Creating a connection to an external website through a JavaScript function within an Angular application

I am currently working on an Angular application. Within the index.html file, there is a header that contains links to external websites. <a href="#" onclick="getExternalUrl('about.html');">Click here </a> <scr ...

Is it possible to design personalized horizontal tables using AG-Grid?

Can someone help me create a table with the specific format shown in the image below? https://i.sstatic.net/mzqiY.png I've searched through their documentation, but couldn't find any reference to this layout. Currently, I'm styling a form ...

How can I make TypeScript mimic the ability of JavaScript object wrappers to determine whether a primitive value has a particular "property"?

When using XMLValidator, the return value of .validate function can be either true or ValidationError, but this may not be entirely accurate (please refer to my update). The ValidationError object includes an err property. validate( xmlData: string, opti ...

Tips for adjusting the color of sorting arrows in the Header of a Data table using Angular Material

I'm having trouble changing the header color of the sorting arrows in the Angular Material data table. You can view the data table here. Currently, the sorting arrows are gray by default and I want to change them to white. Despite my efforts, I haven ...

Adjust CSS style height dynamically

I am currently creating a leaderboard for users: <div class="user"> <ul id="jogadores" *ngFor="let u of sortedUsers$; let i=index;" (click)="routeToUser(u.id)"> <li class="user"> <img class="gravatar" src="https://www.gra ...

Error in Vue & TS: Property does not exist

Currently working with Vue.js and TypeScript, I've managed to create a DatePicker. However, I'm facing issues when trying to build the project due to TypeScript errors. Below is a snippet from my DatePicker TypeScript file: import Vue from " ...

Dealing with errors in RxJs when there is a nested request in a map function

When using my login service, I encounter an issue with error handling and request sequencing. Here is the current implementation: // LoginComponent this.authService.loginDb(credentials) .subscribe(() => { this.router.navigate(['/da ...

Having trouble with enzyme in React Typescript application

One of my components is called app.tsx import React, { useState } from "react"; const TestComponent = () => { return( <> <div className="head">hey there</div> <select name="xyz" id=&qu ...

The Angular4 service being utilized is not defined within the public function

Currently, I am facing an issue with my services setup. I have two services in place - the first service is responsible for the map function within the http CRUD Function, while the second service is supposed to perform a task that is provided by the first ...

How do I create a generic function in TypeScript that adjusts its behavior based on the input argument?

Is there a way to create a generic function that can accept generic arguments like Data<string, number>? Take a look at this code snippet: interface Data<T,R> { a:T; c:R; } function foo( data: Data<string, number> ){ return t ...

Duplicate the ng-template using ng-content as the body (make a duplicate of ng-content)

I have been working on creating a feature that allows users to add custom columns to a PrimeNg table. The main reason for developing this feature is to provide users with a default table that already has numerous configuration options pre-set. However, I ...

Updating a value in an array in Angular using the same ID

I have an array of buildings that looks like this: const buildings = [ { id: 111, status: false, image: 'Test1' }, { id: 334, status: true, image: 'Test4' }, { id: 243, status: false, image: 'Test7' }, { id: 654, stat ...

What could be causing axios to not function properly when used with async/await in this particular scenario

I need to update the DoorState when a button is clicked. After sending a request to the API to change the DoorState, I then call another API to check the status of the robot. Even though the DoorState has been successfully changed, it seems that the chan ...

Warning from Google Chrome: Ensure password forms include optional hidden username fields for improved accessibility

Upon visiting the "reset password" route of my single-page application and checking the Chrome browser console, I am presented with a warning message: [DOM] Password forms should contain (optionally hidden) username fields for accessibility: (More info: g ...

To continue receiving rxjs updates, kindly subscribe if the specified condition is met

Is there a way to check a condition before subscribing within the operator chain? Here's what I have: // parentElem:boolean = false; // the parent elem show/hide; let parentElem = false; // inside the ngAfterViewInit(); this.myForm.get('grandPa ...

"Enhance your database with Firebase's dynamic features for adding and removing

Within my firebase database, I have the following data structure: -ActionSheet -PendingApproval -SomeKey1 -someData -someData -someData -SomeKey2 -someData -someData ...