I am trying to create a custom listView template, for example:
import listTemplate from '../templates/listTemplate.html'; var users = admin.getEntity('users'); users .listView() .template(listTemplate) .actions([]) .title('All users') .perPage(10) .fields([ nga.field('email'), nga.field('name') ]) .filters([ nga.field('filter', 'template') .label('') .pinned(true) .defaultValue('') .template('<div class="input-group"><input type="text" ng-model="value" placeholder="Search..." class="form-control"></input><span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span></div>') ]) .listActions(['edit', 'show']);
and listTemplate.html, I copied the ng-admin source code:
<div class="row list-view" ng-class="::'ng-admin-entity-' + listController.entity.name()"> <div class="col-lg-12"> <ma-datagrid name="{{ ::listController.view.name() }}" entries="listController.dataStore.getEntries(listController.entity.uniqueId)" selection="selection" fields="::listController.fields" list-actions="::listController.listActions" entity="::listController.entity" datastore="listController.dataStore"> </ma-datagrid> </div> </div> <div class="row" ng-if="::!listController.infinitePagination"> <div class="col-lg-12"> <ma-datagrid-pagination page="{{ listController.page }}" per-page="{{ ::listController.view.perPage() }}" total-items="{{ listController.totalItems }}" set-page="::listController.setPageCallback"> </ma-datagrid-pagination> </div> </div> <ma-datagrid-infinite-pagination ng-if="::listController.infinitePagination" per-page="{{ ::listController.view.perPage() }}" total-items="{{ ::listController.totalItems }}" next-page="::listController.nextPageCallback"> </ma-datagrid-infinite-pagination>
But it just shows an empty list when I open the browser, because the custom listView template cannot get an instance of listController. Can anyone help me?
source share