javascriptfieldfrontendng-admin

How do I hide "remove" buttons for embedded_list field in ng-admin?


I'm trying to figure out a way to NOT show the remove buttons for embedded lists in ng-admin.

My goal is to show and edit these nested items in editionView, but you should not be able to remove any nested items.

users.editionView()
  .title('Edit user')
  //... bunch of fields here.
  .nga.field('context', 'embedded_list')
      .targetFields([
        //... more fields, and then further nested fields:
        nga.field('categories', 'embedded_list')
          .targetFields([
            nga.field('title')
            nga.field('score')
          ])
      ])
  ]);

The problem I get here is that if I set the fields labeled as 'embbeded_list' to .editable(false), then all its nested fields also become uneditable.

I want to edit the fields, but a user should not be able to remove a whole item."title" and "score" together is what I mean by an "item", since there can be any number of these, and same for "context".

Thanks for any help in advance!


Solution

  • Try overriding the template with .template(). The current template is a good starting point:

    https://github.com/marmelab/ng-admin/blob/master/src/javascripts/ng-admin/Crud/field/maEmbeddedListField.js