https://antibiotiqueaugmentin.com/surdosage-augmentin-bebe/
× Welcome to the ToolsJX forum!


Three grids filtered by single form search field

  • tvonderhaar
  • tvonderhaar's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 11 months ago #2786

I have created my first grid, associated it with a Joomla table, then using the Show Search Form, Use Advanced Filters and an Advanced Filter using a List for one of the fields, I now have a working page. My question, I have two additional grids that need to be filtered by the same field, but the data for the two additional grids exists in two different tables, hence the need for a total of three grids. Is there a way to link the search fields together across three grids?

Thanks,
Tim

Please Log in or Create an account to join the conversation.

  • tvonderhaar
  • tvonderhaar's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 11 months ago #2787

I think I have found a work around. If I turn off the Show Search Form, I can created my own drop down using php and my table data, then on the select event, do a URL change with the search parameters appended to the page URL. I have tested it to work for more than one grid. The only issue I see is the large white space left over where the search fields would normally be. Even though they aren't shown, the space is still taken up as if they were there.

Please Log in or Create an account to join the conversation.

More
9 years 11 months ago #2794

This is the right approach. Currently it is not possible to use one search form for multiple tables, but we already have a plan to implement it in the future.

You could try to reduce this white space by inpecting the html and css markup and do some tweaks in css or in the php file where the output is generated:
/components/com_grid/layouts/GridView.php

Please Log in or Create an account to join the conversation.

  • tvonderhaar
  • tvonderhaar's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 10 months ago #2811

I have this basically working now. I force the entry of the page containing the three grids using a URL search parameter I know will now be found so no records are shown. Then by selecting an area via a dropdown, I update the search URL and all three grids update correctly. The problem I have now, if I click one of the row columns to sort, all the records are shown, not just the filered records from the search filter. Why is this occuring and what can I do to either disable the user from being able to sort the listing or insure just the filtered data is sorted instead of all the tables data?

Please Log in or Create an account to join the conversation.

More
9 years 10 months ago #2817

Hi,

Sorting works the same way as searching for one table. It takes the values from the search form and the clicked header, then generates the database query to search or sort or both. What I would do is the following. I would create hidden input fields with same names and ids as search fields would have, if you show the search form for each table. Next fill the hidden fields with the search values. When you perform the ordering, the table will check those hidden fields and take those values into account.

You can also take a look at the javascript function searchjx in /components/com_grid/js/grid.js to get the idea.

Please Log in or Create an account to join the conversation.

Moderators: tomaz
Time to create page: 0.148 seconds

Contact Us

Contact us on Discord

Contact us on Facebook