marmelab / ng-admin

Add an AngularJS admin GUI to any RESTful API
http://ng-admin-book.marmelab.com/
MIT License
3.95k stars 725 forks source link

how can I use other field's value be a query condition with referenceField #1392

Closed jiaming0708 closed 1 year ago

jiaming0708 commented 6 years ago

I want to use other field to be a query condition, but I have no idea how to do

var curriculum = nga.entity('curriculums');

nga.field('region', 'reference'),
nga.field('curriculum', 'reference')
          .targetEntity(curriculum)
          .targetField(nga.field('name'))
          .remoteComplete(true, {
            refreshDelay: 300,
            searchQuery: function (search) {
            // use the region be the query condition
              return { q: search };
            }
          }),
jiaming0708 commented 6 years ago

or I can trigger the curriculum field values when region change?