marmelab / ng-admin

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

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

Closed jiaming0708 closed 11 months ago

jiaming0708 commented 5 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 5 years ago

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