1. NOTICE: If you are using Fabrik and update to Joomla 3.10, you will need to update to Fabrik 3.10. And, if you are using Fabrik, do not upgrade to Joomla 4, we do not have a supported version ready for release. More information on a release date coming soon. Also, please note that Fabrik 3.10 will not install on any Joomla sites less than 3.8.
    Dismiss Notice

Prefilter by date but keep using the filters for List

Discussion in 'Community' started by mirceat, Oct 22, 2021.

  1. mirceat

    mirceat Member

    Level: Community
    Hello,

    I know that i can add a prefilter condition to filter all the records from latest 6 months for a specific view level:

    Code (Text):
    where:
    field = contracts_tool___date_time
    condition: greather than
    value: DATE_SUB(NOW(), INTERVAL 6 MONTH)
    type=no quotes
    But I also need to allow for this view level to search for records older than 6 months if they want. The "contracts_tool___date_time" element have Filter type set to Range, but because of prefilter it only shows records from last 6 months...how can i pass this restriction when the element is used for filtering in List view?

    Thank you
     
  2. juuser

    juuser Well-Known Member

    Level: Community
    troester likes this.
  3. troester

    troester Well-Known Member Staff Member

    Level: Community
    You'll need a SystemLinks/URL menu item. As far as I can remember the "Query string" setting in the Fabrik List menu is doing only for simple filtering like &foo=bar.

    An other possibility (e.g. if the "full" view is usually not needed):
    2 list menu items, one with the prefilter, one without
     
  4. juuser

    juuser Well-Known Member

    Level: Community
    And to make it even more user friendly, you can link to the "all" menu item in your list's intro, so you would have a link something like "Show all" or "Show older records" in list heading.

     
    troester likes this.
  5. mirceat

    mirceat Member

    Level: Community
    Well, I tried with the following code (the menu was changed from Fabrik to System Links/URL):

    index.php?option=com_fabrik&view=list&listid=259&contracts_tool___date_time[value][]=-6 month&contracts_tool___date_time[value][]=now&contracts_tool___date_time[condition]=BETWEEN

    But i cannot get the latest 6 months, instead the range is between 22/04/2022 and today
     
  6. troester

    troester Well-Known Member Staff Member

    Level: Community
    As far as I can see the dates are showing correctly in fabrikdebug and it's filtering the correct records but the range filter is showing nonsense.
     
  7. mirceat

    mirceat Member

    Level: Community
    Yes, and that mean when i press Next to move to next page I get no records available..
     
  8. troester

    troester Well-Known Member Staff Member

    Level: Community
    So I would switch to the two menu items/links in list intro...
     

Share This Page