Usages Basic Usage

Basic Usage

PanemuTableController provides a way of interacting with the grid. It requires 2 parameters:

  1. List of columns. Use PanemuTableService.buildColumns() method to create them. In most case, only field parameter is required. Field autocompletion is supported.
Field autocompletion
  1. A function to get the data. For basic usage, in which the sorting, filtering and grouping are done in client side, use PanemuTableDataSource.
controller = PanemuTableController.create(
    this.columns,
    new PanemuTableDataSource(DATA),
    { 
      autoHeight: true
    },
    
  );

In that snippet, the autoHeight property is set to true. It will displays all rows and the table height will adjust accordingly.

After that, pass the controller to PanemuTableComponent.

<panemu-setting [controller]="controller"/>

Then call PanemuTableController.reloadData() preferably in ngOnInit to render the data in the table.

Always call PanemuTableController.reloadData() after setting data to datasource, or after changing controller's criteria and groupByColumns properties.

Id
Name
Email
Gender
Country
Amount
Date Info
Verified
Enrolled
Last Login
1 Abagail Kingscote F Philippines 9339.72 2023-04-26 true
2 Nicolina Coit M Kazakhstan 3744.95 2023-11-01 false
3 Sarene Greim M 4397.68 2023-01-03 true
4 Blair Millbank F Philippines 3334.58 2023-07-01 false
5 Kliment Sprowle M Indonesia 6459.93 2023-12-25 true

When user click a column header, the sorting is handled by the datasource.

Client Side Pagination

For more advanced scenario, the data is from server and then broken down into several pages by the datasource. PanemuPaginationComponent provide the UI that allows user to enter arbitrary range, i.e: 34-47, and move between pages by clicking the previous and next button. Simply add the following in the html template:

...
<panemu-pagination [controller]="controller"/>
...
/ 266
Id
Name
Email
Gender
Country
Amount
Enrolled
Last Login
Verified
1 Abagail Kingscote Female Philippines 9,339.72 Wed, 26 Apr 2023 Yes
2 Nicolina Coit Male Kazakhstan 3,744.95 Wed, 1 Nov 2023 No
3 Sarene Greim Male United States 4,397.68 Tue, 3 Jan 2023 Yes
4 Blair Millbank Female Philippines 3,334.58 Sat, 1 Jul 2023 No
5 Kliment Sprowle Male Indonesia 6,459.93 Mon, 25 Dec 2023 Yes
6 Winifred Dikle Female Kazakhstan 9,833.93 Sun, 6 Aug 2023 No
7 Chadd Nacci Male China 4,383.54 Tue, 3 Jan 2023 Yes
8 Matthiew Morland Female Greece 9,727.90 Sun, 22 Oct 2023 No
9 Perceval Glasheen Male Netherlands 7,201.29 Sun, 23 Jul 2023 Yes
10 Fenelia Oblein Male Sweden 3,654.03 Fri, 13 Oct 2023 No
11 Lisette Ornells Female Cuba 6,775.49 Fri, 27 Oct 2023 Yes
12 Mellie Anthill Male Philippines 7,474.30 Tue, 31 Jan 2023 No
13 Charles Simkovitz Male Brazil 7,871.40 Sun, 15 Oct 2023 Yes
14 Brett Hew Female Macedonia 6,925.89 Thu, 2 Mar 2023 No
15 Netti Treend Female Peru 6,569.53 Sun, 12 Mar 2023 Yes
16 Donetta Scotland Female Russia 7,647.54 Sat, 17 Jun 2023 No
17 Larry Candish Female Mongolia 8,287.03 Mon, 18 Sep 2023 Yes
18 Ianthe Nijssen Male Georgia 3,230.41 Mon, 3 Jul 2023 No
19 Rivalee Heavyside Male Indonesia 5,557.91 Thu, 18 May 2023 Yes
20 Ekaterina Heyburn Female Indonesia 5,916.96 Mon, 30 Oct 2023 No
21 Cynthia Garrard Female Jamaica 3,155.08 Fri, 15 Sep 2023 Yes
22 Bruis Henryson Male Russia 4,079.36 Tue, 27 Jun 2023 No
23 Brittani Swaby Female Ukraine 7,766.85 Sat, 2 Sep 2023 Yes
24 Johnna von Hagt Male Ukraine 7,231.27 Tue, 3 Jan 2023 No
25 Brooks Kalberer Female Sweden 3,130.28 Thu, 12 Oct 2023 Yes
26 Osmond Beevens Female China 5,242.18 Mon, 14 Aug 2023 No
27 Stephi Forsdicke Male China 3,027.02 Sat, 7 Jan 2023 Yes
28 Kristan Collingworth Male China 6,649.44 Fri, 31 Mar 2023 No
29 Bord Petkov Male Sweden 6,362.19 Mon, 10 Apr 2023 Yes
30 Nara Boorne Female Argentina 6,527.11 Mon, 24 Jul 2023 No
31 Ransell Bullingham Male Philippines 8,855.43 Tue, 5 Sep 2023 Yes
32 Kerr Eastcott Female China 5,105.78 Sat, 28 Jan 2023 No
33 Victor Hallgalley Male China 3,361.66 Mon, 24 Jul 2023 Yes
34 Delia Rosendale Female France 4,381.41 Wed, 21 Jun 2023 No
35 Mickey Belding Female China 8,716.32 Mon, 24 Apr 2023 Yes
36 Pippo MacColl Female France 6,428.34 Tue, 12 Dec 2023 No
37 Radcliffe Castellet Male China 6,133.15 Tue, 28 Mar 2023 Yes
38 Arvie Maxweell Female Thailand 7,053.02 Sun, 21 May 2023 No
39 Darnell Valler Male Poland 4,982.23 Fri, 23 Jun 2023 Yes
40 Mirilla Ziems Female China 6,263.73 Sun, 8 Jan 2023 No
41 Werner Dorin Female Philippines 3,215.49 Wed, 1 Feb 2023 Yes
42 Dael Lesek Male China 4,099.27 Sun, 13 Aug 2023 No
43 Diarmid Dmytryk Male Brazil 3,144.37 Sat, 15 Jul 2023 Yes
44 Eunice Reily Male Indonesia 3,477.99 Wed, 15 Nov 2023 No
45 Matty Duddle Male Macedonia 5,296.22 Sat, 25 Mar 2023 Yes
46 Luciano Godilington Male France 4,139.65 Mon, 7 Aug 2023 No
47 Stacie Vassie Male Ukraine 8,122.35 Sun, 29 Oct 2023 Yes
48 Aharon Samter Female Oman 4,361.33 Fri, 10 Mar 2023 No
49 Hillery Canedo Female Iran 9,719.70 Sun, 9 Jul 2023 Yes
50 Jacquelin Crowcombe Female Morocco 7,359.53 Thu, 15 Jun 2023 No
51 Allayne Bachelor Male Poland 3,332.50 Wed, 19 Apr 2023 Yes
52 Lindie Bodley Male Armenia 3,413.69 Fri, 14 Apr 2023 No
53 Sharia Roskelly Female Bulgaria 8,705.67 Fri, 24 Feb 2023 Yes
54 Saul Ubsdale Male France 7,604.27 Thu, 8 Jun 2023 No
55 Nate Churms Female Colombia 7,457.68 Tue, 11 Jul 2023 Yes
56 Tracey Bucknall Male Afghanistan 9,351.93 Mon, 13 Feb 2023 No
57 Carole Sparrow Female Russia 6,366.73 Tue, 3 Jan 2023 Yes
58 Jennica Pashba Female Vietnam 4,825.08 Sun, 5 Mar 2023 No
59 Carlotta Turvey Female Philippines 6,191.06 Tue, 7 Mar 2023 Yes
60 Drucill Roaf Female China 4,394.57 Thu, 26 Jan 2023 No
61 Lucien Steuart Female Japan 5,225.22 Fri, 10 Nov 2023 Yes
62 Daryl Slimon Male Portugal 6,995.50 Sun, 17 Dec 2023 No
63 Sheelah Laydon Male Poland 7,313.91 Tue, 18 Jul 2023 Yes
64 Bertie Brewood Male Ivory Coast 9,912.11 Mon, 27 Nov 2023 No
65 Louise Rosin Male Hungary 8,218.10 Sun, 11 Jun 2023 Yes
66 Ara Gaskins Female Bulgaria 5,960.34 Mon, 6 Feb 2023 No
67 Roshelle Tollemache Female Mexico 5,319.58 Wed, 10 May 2023 Yes
68 Mabelle Schwanden Female Vietnam 6,830.94 Mon, 10 Jul 2023 No
69 Fayina Parsonson Male China 5,845.86 Sat, 2 Sep 2023 Yes
70 Chancey Blackway Female France 6,252.95 Thu, 28 Sep 2023 No
71 Josee Dasent Male China 7,682.65 Fri, 3 Mar 2023 Yes
72 Larisa Dillway Female China 5,202.31 Mon, 23 Oct 2023 No
73 Oby Woolard Female Russia 5,111.98 Sat, 12 Aug 2023 Yes
74 Marylou Lebang Male Spain 7,076.70 Sun, 27 Aug 2023 No
75 Nollie Rillett Female Ivory Coast 9,177.99 Sun, 10 Dec 2023 Yes
76 Jillayne Geal Female China 8,314.71 Thu, 22 Jun 2023 No
77 Andreas Marling Female Senegal 8,927.05 Sat, 1 Apr 2023 Yes
78 Edwin Kilmister Female Ukraine 4,888.32 Fri, 17 Mar 2023 No
79 Hershel Cornelis Male Indonesia 4,712.07 Sat, 25 Mar 2023 Yes
80 Nancy Tomanek Female Russia 8,979.17 Sat, 13 May 2023 No
81 Kikelia Hawgood Male Albania 8,688.32 Sat, 1 Apr 2023 Yes
82 Cele Thridgould Male Poland 4,559.98 Fri, 30 Jun 2023 No
83 Petronella Fairbank Male Czech Republic 7,322.40 Tue, 13 Jun 2023 Yes
84 Thorn Maruszewski Male Syria 5,074.47 Fri, 2 Jun 2023 No
85 Jodi Tall Female Kyrgyzstan 8,097.92 Sat, 20 May 2023 Yes
86 Bail Ehlerding Female China 8,739.09 Fri, 3 Feb 2023 No
87 Natal Thorald Male Croatia 7,632.75 Fri, 29 Sep 2023 Yes
88 Krishna Burwood Male Poland 4,722.89 Mon, 29 May 2023 No
89 Zarah Mousdall Female China 8,195.89 Thu, 1 Jun 2023 Yes
90 Torre Moss Female China 3,262.70 Wed, 10 May 2023 No
91 Merry Paridge Male China 8,407.38 Mon, 13 Mar 2023 Yes
92 Laurene Lucius Female Philippines 4,604.98 Wed, 6 Dec 2023 No
93 Isa Braine Male Panama 4,844.65 Fri, 8 Sep 2023 Yes
94 Leisha Tompsett Male China 6,575.16 Tue, 8 Aug 2023 No
95 Florry O'Doireidh Male Denmark 4,294.56 Wed, 4 Jan 2023 Yes
96 Sophi Roberti Male China 3,185.59 Fri, 9 Jun 2023 No
97 Leanora Nester Male China 7,958.93 Sat, 10 Jun 2023 Yes
98 Giacopo Stallion Male China 8,455.91 Fri, 13 Oct 2023 No
99 Euell Yanshonok Female Czech Republic 5,455.26 Thu, 27 Jul 2023 Yes
100 Cyrillus Gilstoun Female China 5,418.84 Sun, 5 Nov 2023 No

Clicking the previous button on the first page will go to the last page and vice versa. Above example also shows a glimpse of how to format data displayed in the table for example formatting Date, DateTime and Decimal.

Client Side Grouping and Filtering

PanemuTableDataSource also supports client side grouping and filtering. The corresponding UI component to interact with this functionality is PanemuQueryComponent.

<panemu-query [controller]="controller"></panemu-query>
splitscreen_top
Country
Verified
search
true
/ 51
Id
Name
Email
Gender
Country
Amount
Date Info
Verified
Enrolled
Last Login
arrow_rightPhilippines (7)
arrow_rightUnited States (2)
arrow_rightIndonesia (16)
arrow_rightChina (25)
arrow_rightNetherlands (1)
arrow_rightCuba (1)
arrow_rightBrazil (8)
arrow_rightPeru (3)
arrow_rightMongolia (1)
arrow_rightJamaica (1)
arrow_rightUkraine (4)
arrow_rightSweden (2)
arrow_rightPoland (7)
arrow_rightMacedonia (1)
arrow_rightIran (1)
arrow_rightBulgaria (1)
arrow_rightColombia (1)
arrow_rightRussia (5)
arrow_rightJapan (4)
arrow_rightHungary (1)
arrow_rightMexico (1)
arrow_rightIvory Coast (1)
arrow_rightSenegal (1)
arrow_rightAlbania (1)
arrow_rightCzech Republic (3)
arrow_rightKyrgyzstan (1)
arrow_rightCroatia (1)
arrow_rightPanama (1)
arrow_rightDenmark (1)
arrow_rightMorocco (1)
arrow_rightNigeria (2)
arrow_rightFrance (1)
arrow_rightTunisia (1)
arrow_rightAfghanistan (2)
arrow_rightCanada (1)
arrow_rightHaiti (1)
arrow_rightThailand (1)
arrow_rightBosnia and Herzegovina (1)
arrow_rightFinland (1)
arrow_rightPortugal (4)
arrow_rightGeorgia (1)
arrow_rightGreece (2)
arrow_rightArgentina (3)
arrow_rightBurkina Faso (1)
arrow_rightHonduras (1)
arrow_rightSpain (1)
arrow_rightEritrea (1)
arrow_rightGuatemala (1)
arrow_rightSouth Africa (1)
arrow_rightMauritania (1)
arrow_rightNorway (1)

That example also shows how to set description of gender column in a delayed manner in scenario where the descriptions is taken from server.