javascriptng-admin

NG Admin targetEntity Relationship limited by pagination


I have a targetEntity defined for a relationship in my creation view on my User entity, however when the list loads the entities, the api call is including the default paging, so the list is not complete.

nga.field('CompanyId', 'reference')
        .label('Company')
        .targetEntity(companies)
        .targetField(nga.field('Name'))
        .validation({required: true}),

how can I tell it to load ALL the companies, and not perform pagination. Note I still want pagination on the companies list page.


Solution

  • For all of those in futureland the answer is to add .perPage(undefined) to the field definition, and then handle this in the restangularConfiguration, and remove the paging completely :

    nga.field('CompanyId', 'reference') .label('Company') .targetEntity(companies) .perPage(undefined) .targetField(nga.field('Name')) .validation({required: true})

    RestangularProvider.addFullRequestInterceptor( (element, operation, what, url, headers, params, httpConfig) => { // PAGINATION if (params._page != undefined && params._perPage != undefined) { params.$skip = (params._page - 1) * params._perPage; params.$top = params._perPage; } else{
    delete params.$skip; delete params.$top; } delete params._page; delete params._perPage;