Is it possible to set up the search function so that it can search both levels of a multi-level form

Is it possible to set up the search function so that it can search both levels of a multi-level form

koniahinkoniahin Posts: 186Questions: 39Answers: 7

We have several multi-level forms. In general they work very well. Call it parent/child.

  1. Say you access the parent form/page.
  2. You get the standard buttons, list # results, and Search.
  3. The search searches parent data only.
  4. Once you select the parent we have it set up so that it lists child data on the same page below the company table.

Imagine the parent being a list of companies. The child is a list of contacts within each company/business. If you know the name of the company Joe works for (Company A) you first select the company then you get the child contacts list and you can search for Joe or list everyone who works for Company A.

Supposing you don't remember the company only remember the name, maybe Joe Plumber. You would have to:

1) List each company one by one
2) Search within the contacts list

This could be incredibly time-consuming. The question becomes, "Is there a way to configure datatables so that you could use the parent search and list child results?" I know this might get a little weird.

An alternative might be todo something like create a separate contacts form for general listing, searching purposes and within each contact link back to the company.

Over...

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,450Questions: 26Answers: 4,975

    I'm assuming you are doing something like this blog where the child table fetches the contacts via ajax when the parent row is selected. In this case there is nothing in the tables that tie the contacts to the company. One option might be to have a contact search input which would send a jQuery ajax() request to the server with the search term. The server will respond with the company name.

    In the ajax success function use rows().select() with a row-selector as a function to match the company name in the parent and have it selected. See this example for the row selection piece:
    https://live.datatables.net/bibuqupo/1/edit

    My assumptions might be wrong. If they are please provide more details of the parent/child solution.

    Kevin

  • koniahinkoniahin Posts: 186Questions: 39Answers: 7

    Yes we call it multi-level, and yes it works like https://datatables.net/blog/2016-03-25.

    Honestly I don't get what you are talking about. Javascript is not my friend. I will forward this to my partner and see if he understands.

    My alternate solution is sounding much simpler to me. If I have all the child level data in a table it is easy enough to create a searchable form and I think add a link in table view that track back to the parent table. We would have to figure out how to not only track upstream to the parent table but figure out how to highlight/select the parent, the business in the table.

  • koniahinkoniahin Posts: 186Questions: 39Answers: 7
    Answer ✓

    I decided at least for the time being, togo with the alternate solution. If you have signed up for an account and I have updated your access level, you view it if you want under the DTE menu called Flat contact list.

    Please close this post.

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    edited March 2023

    Understood - many thanks for letting us know. If you come back to this, just shout.

    Regards,
    Allan

Sign In or Register to comment.