Do-it-yourself repeatagle group

lori19

Active Member
Hi all

Here’s a case study on how to set up a do-it-yourself repeat ablegroup, as a demonstration of the power and flexibility of Fabrik. And maybe someone finds it useful for her/his own project.

Why would one need a DIY-repeat group instead of using the built-in option? Good question, here’ s the context: I’m working for an NGO in Kenya that has a number of beneficiaries in different projects whose progress they want to monitor. So the obvious approach would be to make alist for the beneficiaries and a replaceable group for tracking the progress (e.g. interactions, milestones etc.). Now, because a beneficiary can be in several projects at the same time and each project has somewhat different data to track in the progress section, the repeatable group becomes very crowded, and half of the fields are not relevant depending on which project we want to report. In the form, the table view of the repeatable group ristks to be very long so that you have to scroll horizontally. And the list view of the repeatable group also becomes very long and is not very easy to scan if you have a number of entries. What would be needed are sub-groups within the repeatable group that one can show or hid ad needed.

A solution is to replace the repeatable group with an independent list and show the list on the beneficiaries detail view, displaying only the rows that are linked to this particular beneficiary. For this, you need to set up a parent_id field in your progress list and define an alternate URL for the Add button that pre-fills the parent_id. For example:

index.php?Itemid=301&option=com_fabrik&view=form&formid=9&progress___parent_id={beneficiaries___id}

As you can see, I picked the value for the parent_id from the beneficiaries list. You can also prefill other fields in the progress list if you need to.

To show the progress list in the details view of the beneficiary, I use a simple display element that returns a Fabrik content plugin:

$beneid = '{beneficiaries___id}';
$interv = '{fabrik view=list id=9 progrress___parent_id='.$beneid.' orderby=progress___date orderdir=desc fabrik_show_nav=0}';
return $interv;

The advantage of this is that I can have different groups in the progress list that are shown/hidden depending on the projects. And I can configure precisely what field is displayed in the progress list view. The user can now see with one glance what progress a beneficiary is making. If needed, he can view the details of each progress row.

One issue remains: You’re only able to show the progress list ind the details view of the beneficiary. You cannot display it in the forms view, as your form will not work anymore: nested forms are not allowed. What to do?

I moved the Fabrik content plugin into a custom module and imported the rowid from the URL like this:

{fabrik view=list id=9 progress___parent_id=[rowid] orderby=progress___date orderdir=desc fabrik_show_nav=0}

This module I then inserted this into the outro text of the beneficiary form. Now I can open the beneficiary in the edit form and have the press list at the very bottom, after the Save button. Like this, the two forms don’t overlap, and both are functional. To make it more easy and also intuitive to use, I turned on ajaxify for the links of the progress list. Now if the user wants to add, edit, or view something in the progress list, the data/form is opened in a popup modal, and the beneficiary’s form stays open in the background, which helps the user to see on what level he’s working right now: the progress form seems a part of the beneficiaries form.

Cheers!
Lorenz
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top