Tags » Pagination

Implement Paging on ASP.NET #MVC #App in 5 Steps

Paging in ASP.NET MVC Application

To implement paging on an ASP.NET MVC Application following steps are to followed :-

Step 1 : Create a new C# ASP.NET Web project named Student_Management_System. 170 more words


How to paginate an array in Laravel

In Controller::


namespace App\Http\Controllers\Frontend;

use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;

class HomeController extends Controller
 public function index(Request $request)
        //start popular cities
        $popularCityArray   = array();
        $cityRepo           = new CityRepository();
        $popularCityRepo    = new PopularCityRepository();
        $popular_cities     = $popularCityRepo->getObjs();

        foreach($popular_cities as $popular_city){
            $cityObj = $cityRepo->getObjByID($popular_city->city_id);
            $cityObj->order = $popular_city->order; //bind order to city obj
            //add city obj to city array
            array_push($popularCityArray, $cityObj);
        //end popular cities

        //start paginating popular cities array
        $currentPage = LengthAwarePaginator::resolveCurrentPage();
        $col = new Collection($popularCityArray);
        $perPage = 3;
        $currentPageSearchResults = $col->slice(($currentPage - 1) * $perPage, $perPage)->all();
        $popularCityEntries = new LengthAwarePaginator($currentPageSearchResults, count($col), $perPage);

        //end paginating popular cities array

        return view('frontend.home')

… 6 more words

Alphabetic Pagination in CakePHP

Open your controller file,

function index($page = 1) {
 $alphabets = range('A', 'Z');
 $alphagroups = array_chunk($alphabets,3);
 $alphagroups[] = array(0,9);
 $cur_alpha = (isset($page))?($page-1):0;
 if($cur_alpha >= 9){
  $reg_cond = '0123456789';
 } else {
  $reg_cond = trim(implode('', $alphagroups[$cur_alpha]));
 $this->set('cur_alpha', $cur_alpha);
 $this->set('alphas', $alphagroups);
 $total = $this->Vendor->find('count');
 $this->set('total', $total);
 $this->Vendor->recursive = -1;
 $vendors = $this->Vendor->find('all', array(
  'conditions' => array('Vendor.name REGEXP' => '^['.$reg_cond.']')
 $this->set('vendors', $vendors);
33 more words

print all data in paginated table/grid

direct Tabular data display

Recently our project has a page need to show tabular data from 30-6000 rows with 3-4 columns. At first, I thought this is pretty reasonable data to show in one page so I just throw the data into a… 998 more words


Paging with Spring Data

This blog shows by an example on how to use paging support in Spring Data. Let start with following repository without paging

public interface ProductRepository extends JpaRepository<Product, Long> {

 @Query("SELECT p FROM product p WHERE p.category= :category")
 List<Product> findByCategory(@Param("category") String category);

} 267 more words

Music Library Search & Tag Program "DJ Helper"

An associate of mine, who does work as a DJ, approached me with a minor problem which frequently arises during his work. He mentioned that when playing a medley of songs, each song has only a handful of other songs which are ‘viable’ to follow up with (due to same ending beat, rhythm, theme, etc). 271 more words