I'm new to laravel and I'm working on a project based on laravel version 4.2. I've got some problems with loading more results using scroll instead of default pagination. I know there are jQuery plugins that can help me out in this, but none of them or suggested ways in web could help me out well.
so here is my code :
laravel model
//inside a AdGenerator class
public function allAds(){
$allAds = DB::table('infos')->paginate(10);
return $allAds;
}
laravel controller
//inside controller
$ads = new AdGenerator();
$allAds = $ads->allAds();
return View::make('view')->with(array(
'ads'=>$allAds,
));
view blade
<table id="ActivationTable" class="table table-striped table-responsive">
<tr>
<th class="col-xs-1">Number</th>
<th class="col-xs-4">Title</th>
<th class="col-xs-2">Field</th>
<th class="col-xs-1">IP</th>
<th class="col-xs-2">Time</th>
<th class="col-xs-1">Status</th>
<th class="col-xs-1">Check</th>
</tr>
@foreach($ads as $ad)
<tr class="box" data-table="{{$ad->tableName}}">
<td></td>
<td>{{$ad->id}} - {{$ad->title}}</td>
<td>{{$ad->tableName}}</td>
<td>{{$ad->ip}}</td>
<td>{{$ad->postTimeConverted}}</td>
@if($ad->active == 1)
<td><span class="text-success">active</span></td>
@else
<td><span class="text-danger">not active</span></td>
@endif
</tr>
@endforeach
{{ $ads->links() }}
<div id="here"></div>
</table>
Till here , everything works fine . It creates ul.pagination and loads specific results for each page. but how should I exactly use infiniteScroll or jScroll plugins to hide pagination and load more table results by scrolling ?
I have made a infinit scroll with the Laravel 5 Pagination. I hope this can help you or anybody else.
The javascript file
Partial view file (Looping out items)
Dashboard controller-file
Main view file