cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MartinVargas
Post Patron
Post Patron

Filter list depending on what is entered in a text field

Hello community, I am working with a portal in power apps.

I am trying to filter the list shown to the right, based on the text entered in the "Title" field of my form. In a certain way I want to filter the "Keywords" list by what is entered in the "Title" field.

MartinVargas_0-1664984271943.png

 


This is the javascript that I have implemented

function onPrimaryChange(){

    // get id of selected primary field

    // this will work only if you render primary field as dropdown

    let primaryValue = $("#title").val();

    var list = $(".entity-grid");

    

    if(primaryValue != null && primaryValue !=""){

        console.log("titulo:" + primaryValue);

        

list.find("table tbody > tr").each(function () {

                var tr = $(this);

                //var adminOnly = $(tr).find('td[data-attribute="title"]').attr("aria-label");

                var adminOnly = $(tr).find('td[data-attribute="title"]').attr("data-value");

                //console.log("prueba1: " + adminOnly);

                if (!adminOnly.includes(primaryValue)){

                    tr.hide();

                    list.show();

                }

                else

                {

                    tr.show();

                    list.hide();

                }

        });

    }else if(primaryValue == null || primaryValue =="")

    {

        list.hide();

    }

       }

 

 

Any ideas?
@OliverRodrigues 

@OOlashyn 

@justinburch 

 

 


Can someone help me here?

Thanks cheers.

5 REPLIES 5
OliverRodrigues
Super User
Super User

Hi, are you using a complete custom JavaScript filter? or the OOB filters? 

I feel like the OOB should cover your requirement, see if this article helps: Entity List filters for Power Apps Portals - Ulrikke Akerbæk (akerbak.com)

 




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Pages Super User | MVP


Oliver Rodrigues


 

MartinVargas
Post Patron
Post Patron

Hi @OliverRodrigues , I am using a custom filter in javascript and a form. My situation is that when entering information in a field of my form, I should filter my list if any word entered matches the field of the form.

 

Greetings.

OliverRodrigues
Super User
Super User

a few more questions:

  • is your list s subgrid or a list?
  • is the filter to happen while typing?
  • what's the business requirement for this? 



If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Pages Super User | MVP


Oliver Rodrigues


 

MartinVargas
Post Patron
Post Patron

Hi @OliverRodrigues 

 

-Is your list a subgrid or a list?
It's a list of a table I have in dataverse.

-Does the filter have to happen while writing?
It is correct, the filter must be executed when the value entered by the user changes, in this case in the title field.

-What is the business requirement for this?
The commercial requirement is that our clients can raise tickets through our page, at this moment I am working on the form filling section and when the client enters his problem in the title section, our list should show the knowledge articles that match the keywords entered by the client so that the client has the opportunity to self-serve and if possible can solve their problems through these articles.

 

Ready friend!

OliverRodrigues
Super User
Super User

Thanks for the info, this feature is actually OOB from Power Apps Portals with case management:

How to add Knowledge Base Articles in Power Apps Portals | Magnetism Solutions | NZ (Auckland, Welli...

Configure and manage category for knowledge articles - Power Apps | Microsoft Learn

hope this helps 




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Pages Super User | MVP


Oliver Rodrigues


 

Helpful resources

Announcements
Carousel Community Blog

Check out the Community Blog

Read all about the most recent blogs in the community!

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Carousel News & Announcements

What's New in the Community?

Check out the latest News & Events in the community!

Users online (4,251)