I basically have a table which needs to be filled with data from rows in my database. I have a next and previous button to move through the different records in my database. I will also have a filter.
What are the advantages/disadvantages of these two approaches? Also Im using laravel if anyone knows of an easy way to do this with lavarel's built in features.
For basic browsing you should use pagination - it's really easy to implement in laravel. Quick examle
$posts = App\Post::paginate(15);
$posts contains now the url to the next page ( 15 entires per page ) and also the data for the first 15 results. Laravel will also provide nice helpers in blade to generate the page buttons.
However, you will only be able to filter on the currently visible 15 entires - therefore you should create a "second table" which will always show the filtered results. You could run an ajax call to query these results for your given filters. Then fill the second table with the results and hide the first one.
When the filter is removed simply hide the second table and show your default table again.
Here's more to read: https://laravel.com/docs/5.2/pagination