Efficiently loading data in a table with a universal filter feature using Angular with PrimeNG

Recently, I managed to set up a datatable with the functionalities of both Lazy loading and global filter. Utilizing PrimeNG components for this implementation was a breeze. However, an issue surfaced where the global filter ceased to function when lazy loading was enabled with [lazy]="true".

HTML Code :

<input #gc type="text" pInputText size="30" placeholder="Global Filter" class="element-space">

<p-dataTable [value]="infoList" [rows]="5" [globalFilter]="gc" [totalRecords]="records" (onLazyLoad)="loadInfo($event)"
  scrollable="true" scrollHeight="200px" virtualScroll="virtualScroll" selectionMode="single" [(selection)]="selectedInfo"
  (onRowSelect)="onInfoRowSelect($event)" dataKey="infoId" class="break-word" resizableColumns="true" [lazy]="true">

TS code :

    lazyLoadOutInfo(event: LazyLoadEvent) {
    setTimeout(() => {
        if (this.infoListData) {
            this.infoList= this.infoListData.slice(event.first, (event.first + event.rows));
        }
    }, 25);
}

It's essential for me to have both features in working order. Any insights or solutions on how to tackle this perplexing challenge?

Answer №1

Leaving this information for future reference since the original question is dated.

Based on my analysis of the discussion in this thread, it appears that this behavior is intentional: https://github.com/primefaces/primeng/issues/1342

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

Updating Angular components by consolidating multiple inputs and outputs into a unified configuration object

When I develop components, they often begin with numerous @Input and @Output properties. However, as I continue to add more properties, I find it beneficial to transition to utilizing a single config object as the input. For instance, consider a component ...

Using the Typescript type 'never' for object fields: a guide to implementing it

I'm attempting to make this specific example function similar to this one: interface Foo { a: number; b: string; c: boolean; } type Explode<T> = keyof T extends infer K ? K extends unknown ? { [I in keyof T]: I extends K ? T ...

What is the best way to insert a triangle shape to the bottom of a div with an opacity level set at 0.2

https://i.stack.imgur.com/sqZpM.png I've been trying to create something similar, but my triangle keeps overlapping with the background in the next section. I've already spent 3 hours on it. Any help would be greatly appreciated. Check out my c ...

Activate the Keypress event to update the input value in React upon pressing the Enter

I am facing an issue where I need to reset the value of an input using a method triggered by onPressEnter. Here is the input code: <Input type="text" placeholder="new account" onPressEnter={(event) => this.onCreateAccount(event)}> < ...

Steps for importing a CommonJS module that exports as a callable into TypeScript

I am dealing with a project that has a mixture of JavaScript and TypeScript files. Within the project, there is a JS library that follows this structure: module.exports = () => { // logic dependent on environment variables // then... return { ...

Understanding the significance of the term "this" in Typescript when employed as a function parameter

I came across a piece of TypeScript code where the keyword "this" is used as a parameter of a function. I'm curious to know the significance of this usage and why it is implemented like this in the following context: "brushended(this: SVGGElement) {". ...

Tips on how to modify the session type in session callback within Next-auth while utilizing Typescript

With my typescript setup, my file named [...next-auth].tsx is structured as follows: import NextAuth, { Awaitable, Session, User } from "next-auth"; // import GithubProvider from "next-auth/providers/github"; import GoogleProvider from ...

What is the best way to create three distinct fractions in JavaScript that cannot be simplified?

I have a specific requirement to create 3 fractions with the following conditions: The denominator remains constant The numerator must be unique and fall within the range of 1 to three times the denominator The fraction should not be reducible (e.g., 2/6 ...

Displaying a single http response in Angular

Having trouble displaying data from a single JSON response using Angular. I've set up a class for the data in interndata.model.ts export class Interndata { humidity: number; temperature: number; constructor(humidity:number, temperature:number) { ...

Breaking down a JSON Object in Angular 4: Step-by-step Guide

I am working on integrating a JSON API with an Angular 4 frontend, and my goal is to display the data from this JSON Object. Here is the code I have used: <div *ngFor="let Questionnaire of struc.data"> <span>{{Questionnaire.attributes.con ...

What is the best way to pass input values to directives?

Is there a way to dynamically pass input field values to directives and then send them to a server via post request? I am looking for a solution on how to achieve this functionality. This is my HTML code: <input type="text" [appHighlight]="appHighligh ...

The error message "Value property is not found on the FilterMetadata type in the PrimeNG table" indicates that there is an issue with accessing the 'value'

While transitioning a module from Primeng 7 to Primeng 11 in conjunction with Angular 11, everything seems to be running smoothly on ng serve with all functionalities working as expected. However, upon building the project, I encounter an unexpected error. ...

Encountering the ObjectUnsubscribedErrorImpl while utilizing angular datatable with angular version 7

I am encountering an issue when trying to display a DataTable in a modal window. Initially, everything works as expected and I can see the screen perfectly. However, after closing the modal window and opening it again, the DataTable no longer shows the sea ...

Automatically Formatting Currency in Angular 6 with Keyup

I am currently facing an issue with using the keyup event in an input element that has a currency pipe in my Angular 8 application. <input placeholder="€0.00" (keyup)="onKey(pointIndex, $event.target.value, item.quantity)" value="{{item.unitPriceWith ...

Struggling to capture the error thrown by the subscribe method in Angular using RxJs

In following the most recent tutorial, I learned about using pipe, tap, and catchError to intercept the result. This is what I currently have: getStatus(): Observable<boolean> { return this.http.get<boolean>('/status').pipe( ...

How can the id from a post response be obtained in Angular 7 when using json-server?

When utilizing the http options below: const httpOptions: any = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }), observe: 'response' }; I execute an http post to a json-server endpoint like this: ...

Encountering an error when attempting to store a value in an array of custom types: "Unable to assign properties to undefined (setting 'id')"

My model looks like this: export class SelectedApplicationFeatures { id: number; } In my TypeScript file, I imported the model as shown below: import { SelectedApplicationFeatures } from "src/app/models/selectedApplicationFeatures.model"; selec ...

Is there a way to determine if a browser's Storage object is localStorage or sessionStorage in order to effectively handle static and dynamic secret keys within a client?

I have developed a customizable storage service where an example is getExpirableStorage(getSecureStorage(getLocalStorage() | getSessionStorage())) in typescript/javascript. When implementing getSecureStorage, I used a static cipher key to encrypt every ke ...

Emphasize cells and headers when a cell's value deviates from its initial value

I implemented cell editing in my primeng table. Here is the code: <div class="card"> <p-table [value]="products" dataKey="id" [tableStyle]="{ 'min-width': '50rem' }"> <n ...

Protractor's compatibility with Headless Chrome is hindered on AWS CodeBuild, yet functions successfully when run locally

I am facing an issue with my webpage that requires Google Authentication before moving on to an angular web page. I have created some basic end-to-end tests which are working perfectly fine in Linux using Chrome Headless: The test finds the username fiel ...