Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement ng-bootstrap 4 table sorting, pagination and filtering

I am going through the official documentation of ng-bootstrap, in some of their official examples, the code is not working. In particular I am talking about this and this examples, when you open them in stackblitz. This makes it hard for me to understand how the code works so that I can implement it my way.

I have seen this question but the answer is outdated as it is for angularjs.

So now my questions is:

  1. How can I implement ng-bootstrap 4 table sorting, pagination and filtering as shown here? What is the issue with the given code why is it not working?

A working example would be great as it would help me see and understand how the code works. Thank you.

like image 349
YulePale Avatar asked Dec 24 '22 01:12

YulePale


1 Answers

I finally have a solution. I went to their github to check the issues and someone confirmed that indeed the stackblitz code has an issue but gave the source code and a work-around.

Here is the working code of an ng-bootstrap 4 table with sorting, pagination and filtering.

I basically organised the code and added a few things that were omitted in the original stackblitz code.

Among the issues that were there, was that the directive wasn't declared in the declarations' array in AppModule.

like image 92
YulePale Avatar answered Dec 26 '22 18:12

YulePale