Angular PrimeNG Table ColumnFilter Properties
Last Updated :
26 Apr, 2025
Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. It provides a lot of templates, components, theme design, an extensive icon library, and much more. In this article, we will see the Angular PrimeNG Table ColumnFilter Properties.
The Table component is used to display data in tabular format. The Table component has many properties provided with it that can be used to style and modify the content of the table to suit various needs. The ColumnFilter Properties is used to filter the data according to the filter the column data values.
Angular PrimeNG Table ColumnFilter Properties:
- field(string): It is the name of the property of the data to filter.
- type(string): It is the data type to display a suitable filter and matches. The default value is text.
- display(string): It is the display mode, valid values are row for a separate row and menu for filter menu. The default value is row.
- showMenu(boolean): It is used to set whether to show the overlay menu. The default value is true.
- matchMode(string): It is the default match mode.
- operator(string): It is the default operator, valid values are "and" and "or". The default value is and.
- showOperator(boolean): It specifies if the operator selection is displayed. The default value is true.
- showClearButton(boolean): It specifies whether to display the clear button. The default value is true.
- showApplyButton(boolean): It specifies whether to display the apply button. The default value is true.
- showMatchModes(boolean): It specifies whether to display the match modes dropdown. The default value is true.
- showAddButton(boolean): It specifies whether to display the add a rule button. The default value is true.
- showButtons(boolean): It specifies whether to display the spinner buttons in "numeric" mode. The default value is true.
- hideOnClear(boolean): It specifies whether to hide the overlay on clear. The default value is false.
- placeholder(string): It is the placeholder content to display on input.
- matchModeOptions(SelectItem[]): It is the match mode option to override the global setting.
- maxConstraints(number): It is used to set the number of maximum constraints. The default value is 2.
- minFractionDigits(number): It is the minimum number of fraction digits to use for the numeric type.
- maxFractionDigits(number): It is the maximum number of fraction digits to use for the numeric type.
- prefix(string): It is the text to display before the value for the numeric type.
- suffix(string): It is the text to display after the value for the numeric type. The default value is decimal.
- locale(string): It is the locale to be used in formatting for numeric type.
- localeMatcher(string): It is the locale-matching algorithm for numeric type. The default value is the best fit.
- currency(string): It is the currency to use in currency formatting for the numeric type.
- currencyDisplay(string): It is used to set the currency to display in currency formatting for the numeric type. The default value is the symbol.
- useGrouping(boolean): It is used to set whether to use grouping separators for "numeric" type, such as thousands of separators or thousand/lakh/crore separators.
Syntax:
<th pSortableColumn="title">
<div class="flex justify-content-between
align-items-center">
Title
<p-sortIcon field="title"></p-sortIcon>
<p-columnFilter
type="text"
field="title"
display="menu"
class="ml-auto">
</p-columnFilter>
</div>
</th>
Creating Angular application & Module Installation:
Step 1: Create an Angular application using the following command.
ng new geeks_angular
Step 2: After creating your project folder i.e. geeks_angular, move to it using the following command.
cd geeks_angular
Step 3: Install PrimeNG in your given directory.
npm install primeng --save
npm install primeicons --save
Project Structure: The project structure will look like the following:
Example 1: In the following example, we have a Table with a Column filter.
HTML
<h1 style="color:green;text-align:center;">GeeksforGeeks</h1>
<h3>Angular PrimeNG Table ColumnFilter Properties</h3>
<p-table
#dt
[value]="tutorials"
dataKey="title"
[rowHover]="true"
[showCurrentPageReport]="true"
[filterDelay]="0"
[globalFilterFields]="['title', 'category', 'rating']"
>
<ng-template pTemplate="caption">
<div class="table-header">List of Tutorials</div>
</ng-template>
<ng-template pTemplate="header">
<tr>
<th style="width: 3rem">
<p-tableHeaderCheckbox></p-tableHeaderCheckbox>
</th>
<th pSortableColumn="title">
<div class="flex justify-content-between align-items-center">
Title
<p-sortIcon field="title"></p-sortIcon>
<p-columnFilter
type="text"
field="title"
display="menu"
class="ml-auto">
</p-columnFilter>
</div>
</th>
<th pSortableColumn="category">
<div class="flex justify-content-between align-items-center">
Category
<p-sortIcon field="category"></p-sortIcon>
<p-columnFilter
type="text"
field="category"
display="menu"
class="ml-auto">
</p-columnFilter>
</div>
</th>
<th pSortableColumn="rating">
<div class="flex justify-content-between align-items-center">
Rating
<p-sortIcon field="rating"></p-sortIcon>
<p-columnFilter
type="numeric"
field="rating"
display="menu"
class="ml-auto">
</p-columnFilter>
</div>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-tutorial>
<tr class="p-selectable-row">
<td>
<p-tableCheckbox [value]="tutorial"> </p-tableCheckbox>
</td>
<td>
<span class="p-column-title"> Title </span>
{{ tutorial.title }}
</td>
<td>
<span class="p-column-title"> Category </span>
<span class="image-text">
{{ tutorial.category }}
</span>
</td>
<td>
<span class="p-column-title"> Rating </span>
<span class="image-text">
{{ tutorial.rating }}
</span>
</td>
</tr>
</ng-template>
</p-table>
JavaScript
import { Component, OnInit, ViewChild } from '@angular/core';
import { Table } from 'primeng/table';
import { PrimeNGConfig } from 'primeng/api';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
})
export class AppComponent {
tutorials: Tutorial[];
@ViewChild('dt') table: Table;
constructor(private primengConfig: PrimeNGConfig) {}
ngOnInit() {
this.tutorials = [
{
title: 'Queue',
category: 'Data Structure',
rating: 8,
},
{
title: 'Circularly LinkedList',
category: 'Data Structure',
rating: 1,
},
{
title: 'Doubly LinkedList',
category: 'Data Structure',
rating: 3,
},
{
title: 'Singly LinkedList',
category: 'Data Structure',
rating: 5,
},
{
title: 'Doubly Ended Queue',
category: 'Data Structure',
rating: 10,
},
{
title: 'Binary Search Tree',
category: 'Data Structure',
rating: 2,
},
{
title: 'Red Black Tree',
category: 'Data Structure',
rating: 9,
},
{
title: 'Breadth First Search',
category: 'Graph',
rating: 6,
},
{
title: "Floyd's Cycle",
category: 'Algorithm',
rating: 7,
},
{
title: 'Travelling Salesman Problem',
category: 'Algorithm',
rating: 4,
},
{
title: 'Bellman Ford',
category: 'Graph',
rating: 8,
},
{
title: 'KMP Algorithm',
category: 'String',
rating: 10,
},
];
this.primengConfig.ripple = true;
}
}
export interface Tutorial {
title?: string;
category?: string;
rating?: number;
}
JavaScript
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { BrowserAnimationsModule }
from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { TableModule } from 'primeng/table';
import { CalendarModule } from 'primeng/calendar';
import { SliderModule } from 'primeng/slider';
import { DialogModule } from 'primeng/dialog';
import { MultiSelectModule } from 'primeng/multiselect';
import { ContextMenuModule } from 'primeng/contextmenu';
import { ButtonModule } from 'primeng/button';
import { InputTextModule } from 'primeng/inputtext';
import { ProgressBarModule } from 'primeng/progressbar';
import { DropdownModule } from 'primeng/dropdown';
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
TableModule,
CalendarModule,
SliderModule,
DialogModule,
MultiSelectModule,
ContextMenuModule,
DropdownModule,
ButtonModule,
InputTextModule,
ProgressBarModule,
HttpClientModule,
FormsModule,
],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}
Output:
Example 2: In the following example, there will be no apply button, the filters will be applied automatically.
HTML
<h1 style="color:green;text-align:center;">GeeksforGeeks</h1>
<h3>Angular PrimeNG Table ColumnFilter Properties</h3>
<p-table
#dt
[value]="tutorials"
dataKey="title"
[rowHover]="true"
[showCurrentPageReport]="true"
[filterDelay]="0"
[globalFilterFields]="['title', 'category', 'rating']"
>
<ng-template pTemplate="caption">
<div class="table-header">List of Tutorials</div>
</ng-template>
<ng-template pTemplate="header">
<tr>
<th style="width: 3rem">
<p-tableHeaderCheckbox></p-tableHeaderCheckbox>
</th>
<th pSortableColumn="title">
<div class="flex justify-content-between align-items-center">
Title
<p-sortIcon field="title"></p-sortIcon>
<p-columnFilter
type="text"
field="title"
display="menu"
class="ml-auto"
[showClearButton]="false"
[showApplyButton]="false">
</p-columnFilter>
</div>
</th>
<th pSortableColumn="category">
<div class="flex justify-content-between align-items-center">
Category
<p-sortIcon field="category"></p-sortIcon>
<p-columnFilter
type="text"
field="category"
display="menu"
class="ml-auto"
[showClearButton]="false"
[showApplyButton]="false">
</p-columnFilter>
</div>
</th>
<th pSortableColumn="rating">
<div class="flex justify-content-between align-items-center">
Rating
<p-sortIcon field="rating"></p-sortIcon>
<p-columnFilter
type="numeric"
field="rating"
display="menu"
class="ml-auto"
[showClearButton]="false"
[showApplyButton]="false">
</p-columnFilter>
</div>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-tutorial>
<tr class="p-selectable-row">
<td>
<p-tableCheckbox [value]="tutorial"> </p-tableCheckbox>
</td>
<td>
<span class="p-column-title"> Title </span>
{{ tutorial.title }}
</td>
<td>
<span class="p-column-title"> Category </span>
<span class="image-text">
{{ tutorial.category }}
</span>
</td>
<td>
<span class="p-column-title"> Rating </span>
<span class="image-text">
{{ tutorial.rating }}
</span>
</td>
</tr>
</ng-template>
</p-table>
JavaScript
import { Component, OnInit, ViewChild } from '@angular/core';
import { Table } from 'primeng/table';
import { PrimeNGConfig } from 'primeng/api';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
})
export class AppComponent {
tutorials: Tutorial[];
@ViewChild('dt') table: Table;
constructor(private primengConfig: PrimeNGConfig) {}
ngOnInit() {
this.tutorials = [
{
title: 'Queue',
category: 'Data Structure',
rating: 8,
},
{
title: 'Circularly LinkedList',
category: 'Data Structure',
rating: 1,
},
{
title: 'Doubly LinkedList',
category: 'Data Structure',
rating: 3,
},
{
title: 'Singly LinkedList',
category: 'Data Structure',
rating: 5,
},
{
title: 'Doubly Ended Queue',
category: 'Data Structure',
rating: 10,
},
{
title: 'Binary Search Tree',
category: 'Data Structure',
rating: 2,
},
{
title: 'Red Black Tree',
category: 'Data Structure',
rating: 9,
},
{
title: 'Breadth First Search',
category: 'Graph',
rating: 6,
},
{
title: "Floyd's Cycle",
category: 'Algorithm',
rating: 7,
},
{
title: 'Travelling Salesman Problem',
category: 'Algorithm',
rating: 4,
},
{
title: 'Bellman Ford',
category: 'Graph',
rating: 8,
},
{
title: 'KMP Algorithm',
category: 'String',
rating: 10,
},
];
this.primengConfig.ripple = true;
}
}
export interface Tutorial {
title?: string;
category?: string;
rating?: number;
}
JavaScript
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { BrowserAnimationsModule }
from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { TableModule } from 'primeng/table';
import { CalendarModule } from 'primeng/calendar';
import { SliderModule } from 'primeng/slider';
import { DialogModule } from 'primeng/dialog';
import { MultiSelectModule } from 'primeng/multiselect';
import { ContextMenuModule } from 'primeng/contextmenu';
import { ButtonModule } from 'primeng/button';
import { InputTextModule } from 'primeng/inputtext';
import { ProgressBarModule } from 'primeng/progressbar';
import { DropdownModule } from 'primeng/dropdown';
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
TableModule,
CalendarModule,
SliderModule,
DialogModule,
MultiSelectModule,
ContextMenuModule,
DropdownModule,
ButtonModule,
InputTextModule,
ProgressBarModule,
HttpClientModule,
FormsModule,
],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}
Output:
Reference: http://primefaces.org/primeng/table
Similar Reads
Non-linear Components
In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co
11 min read
JavaScript Tutorial
JavaScript is a programming language used to create dynamic content for websites. It is a lightweight, cross-platform, and single-threaded programming language. JavaScript is an interpreted language that executes code line by line, providing more flexibility.JavaScript on Client Side : On client sid
11 min read
Steady State Response
In this article, we are going to discuss the steady-state response. We will see what is steady state response in Time domain analysis. We will then discuss some of the standard test signals used in finding the response of a response. We also discuss the first-order response for different signals. We
9 min read
Web Development
Web development is the process of creating, building, and maintaining websites and web applications. It involves everything from web design to programming and database management. Web development is generally divided into three core areas: Frontend Development, Backend Development, and Full Stack De
5 min read
Class Diagram | Unified Modeling Language (UML)
A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact
12 min read
Spring Boot Tutorial
Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance
10 min read
React Interview Questions and Answers
React is an efficient, flexible, and open-source JavaScript library that allows developers to create simple, fast, and scalable web applications. Jordan Walke, a software engineer who was working for Facebook, created React. Developers with a JavaScript background can easily develop web applications
15+ min read
JavaScript Interview Questions and Answers
JavaScript (JS) is the most popular lightweight, scripting, and interpreted programming language. JavaScript is well-known as a scripting language for web pages, mobile apps, web servers, and many other platforms. Both front-end and back-end developers need to have a strong command of JavaScript, as
15+ min read
Backpropagation in Neural Network
Back Propagation is also known as "Backward Propagation of Errors" is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network.It works iteratively to adjust weights and
9 min read
React Tutorial
React is a JavaScript Library known for front-end development (or user interface). It is popular due to its component-based architecture, Single Page Applications (SPAs), and Virtual DOM for building web applications that are fast, efficient, and scalable.Applications are built using reusable compon
8 min read