Fixed #9085 - asset models not showing proper pagination

Huge thanks to @inietov for catching this one
This commit is contained in:
snipe 2021-02-25 16:43:38 -08:00
parent 57e52f0ba4
commit f37d5d3d03
2 changed files with 23 additions and 23 deletions

View file

@ -96,8 +96,9 @@ class AssetModelsController extends Controller
break; break;
} }
$total = $assetmodels->count();
$assetmodels = $assetmodels->skip($offset)->take($limit)->get(); $assetmodels = $assetmodels->skip($offset)->take($limit)->get();
return (new AssetModelsTransformer)->transformAssetModels($assetmodels, $assetmodels->count()); return (new AssetModelsTransformer)->transformAssetModels($assetmodels, $total);
} }

View file

@ -54,28 +54,27 @@
</div> </div>
@endif @endif
<div class="table-responsive"> <div class="table-responsive">
<table <table
data-side-pagination="server" data-columns="{{ \App\Presenters\AssetModelPresenter::dataTableLayout() }}"
data-columns="{{ \App\Presenters\AssetModelPresenter::dataTableLayout() }}" data-cookie-id-table="asssetModelsTable"
data-cookie-id-table="modelsTable" data-pagination="true"
data-pagination="true" data-id-table="asssetModelsTable"
data-id-table="modelsTable" data-search="true"
data-search="true" data-show-footer="true"
data-side-pagination="server"
data-show-columns="true" data-show-columns="true"
data-toolbar="#toolbar" data-toolbar="#toolbar"
data-show-export="true" data-show-export="true"
data-show-refresh="true" data-show-refresh="true"
data-sort-order="asc" data-sort-order="asc"
data-page-size='30' id="asssetModelsTable"
id="modelsTable" class="table table-striped snipe-table"
data-url="{{ route('api.models.index', ['status'=> e(Request::get('status'))]) }}" data-url="{{ route('api.models.index') }}"
class="table table-striped snipe-table" data-export-options='{
data-export-options='{ "fileName": "export-models-{{ date('Y-m-d') }}",
"fileName": "export-asset-models-{{ date('Y-m-d') }}", "ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"] }'>
}'> </table>
</table>
</div> </div>
</div> </div>