SEARCHING with Parent-Child tables
SEARCHING with Parent-Child tables
menashe
Posts: 196Questions: 43Answers: 2
in DataTables 2
I have googled the topic and read (some of) your articles on enhancing the Search, but unfortunately, I am still at a loss.
I want to enhance the search to include additional database tables.
I have Parent-Child (Details) Datatables three (or more) deep. Mostly, the data from each level is obtained from different database tables.
In the example above, how can I search for "Nature's Nectar" (the Brand) in the main Search box (circled in red)?
Answers
Hi Alan,
Are you able to offer insight/pointers as to how to approach this searching issue (above)?
The child row information is not searchable, since it isn't available in the parent table. If you want child row information to be searchable, it needs to be in the top level table. The most common way of doing that is to have it in a hidden column.
However, if you are Ajax loading the nested data (which I presume you are? There is no test case provided, so I can't be sure) then that might be an issue, particularly if it goes multiple layers deep.
Allan
So there is no way to create a custom Search function for the top-level search box?
Absolutely there is. I just wrote a blog post about creating features plugins. Register a feature plugin, have it create a node, and the use a search function (
search()
) to perform whatever search it is for want (or make Ajax calls or whatever you need).Allan