cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Nttdocomo
Frequent Visitor

When opening the view through JS, add a filter

Is there any way to add a dynamic filter based on the current form field content when opening the view through JS on the form 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
ben-thompson Impactful Individual
Impactful Individual

Re: When opening the view through JS, add a filter

Just so that I've got this right

 

You have a subgrid loading a dataset based on a view and you wish to add an additional filter based on the value of a field on the form using Javascript.

 

If that is the case, sadly, there isn't anyway of doing that with the out of the box datagrid but you could create your own PCF Datagrid component and use that to apply the Javascript. 

 

Be warned that you won't be able to attach attribute values directly to the entity so you will need to find a way of telling the PCF Component what fields you wish to use within the filter.

 

 

---
If this post has answered your question please consider it for "Accept as Solution" or if it has been helpful give it a "Thumbs Up".

View solution in original post

3 REPLIES 3
EricRegnier Impactful Individual
Impactful Individual

Re: When opening the view through JS, add a filter

Hi @Nttdocomo,

Possible to elaborate on your scenario and what is meant by "opening the view through JS on the form"? You can add dynamic filters to lookup fields and their views with addCustomView and addCustomFilter. For subgrids, you can set the view with setCurrentView.

Cheers

ben-thompson Impactful Individual
Impactful Individual

Re: When opening the view through JS, add a filter

Just so that I've got this right

 

You have a subgrid loading a dataset based on a view and you wish to add an additional filter based on the value of a field on the form using Javascript.

 

If that is the case, sadly, there isn't anyway of doing that with the out of the box datagrid but you could create your own PCF Datagrid component and use that to apply the Javascript. 

 

Be warned that you won't be able to attach attribute values directly to the entity so you will need to find a way of telling the PCF Component what fields you wish to use within the filter.

 

 

---
If this post has answered your question please consider it for "Accept as Solution" or if it has been helpful give it a "Thumbs Up".

View solution in original post

EricRegnier Impactful Individual
Impactful Individual

Re: When opening the view through JS, add a filter

Hi @Nttdocomo,

PCF is a great way to build custom controls but requires coding. If you're looking for a no/low code option and your filters are fairly simple, you can build your views with the filters already in place and then on load, set the right view based on the field. Again, this works if there are few filters...you wouldn't want to create 100 views for example. If you have a lot and cannot pre-defined, then @ben-thompson solution is the way to go.  

Cheers

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Users online (8,438)