question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add filter to reference depending on another reference

See original GitHub issue

Hi.

i have 2 reference fields, for example, permissions and users, and i want to filter users filed depending on permissions choice, something like:

myEntity.creationView()
    .fields([
        nga.field('permission_id', 'reference')
            .targetEntity(permissions)
            .targetField(nga.field('name')),
        nga.field('user_id', 'reference')
            .targetEntity(users)
            .remoteComplete(true)
            .targetField(nga.field('name'))
            .permanentFilters({ 'permission_id': entry.values.permission_id })
            .template('<ma-reference-field ng-if="entry.values.permission_id" field="::field" value="value" datastore="::datastore"></ma-reference-field>')
    ]);

Is it possible?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
BoussonNicolascommented, Feb 5, 2018

I just made it work perfectly combining the codes from various topics:

and adding “scope.refresh(‘’);” to this piece of code: if (!!field._getPermanentFilters) { scope.$watch('entry.values', function(newValue, oldValue){ field._getPermanentFilters(newValue); scope.refresh(''); }, true); } This is indeed an extra useful feature!! 😃

1reaction
windmaomaocommented, Apr 27, 2016

+1 for this feature. maybe we shouldn’t reuse the name “permanentFilters”, maybe a new call

    .filters(function(entry) { 
        return { 'projectId': entry.project.id };
    } 
Read more comments on GitHub >

github_iconTop Results From Across the Web

Filter reference field based on another reference - ServiceNow
Solved: Hi, I am modifying existing catalog item "Create item" to include some of the custom fields we added in Case. I have...
Read more >
How to filter references based on change in another reference?
Based on your schema, I think this should work: export default { title: "Product Category", name: "category", type: "object", ...
Read more >
Filter by using advanced criteria - Microsoft Support
If the Excel data you want to filter requires complex criteria you can filter by using ... All other references in the formula...
Read more >
Use Reference Filters with Conditions - Skuid Docs
A useful tool for admins, a reference filter points to a reference field—a field in the model's data object that references a field...
Read more >
Field filter reference another field filter in Dashboard - Get Help
You would have to create a lookup table, so both questions would use that for aliasing. It's will quickly get rather complex. Alternatively, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found