1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Subgroup / nested groups

Discussion in 'Community' started by zebrafilm, May 15, 2013.

  1. zebrafilm

    zebrafilm Member

    Level: Community
    Is it possible to use subgroups / nested groups?
    I need to make a form structure like this:

    Main group 3
    Subgroup 3.1
    element 3.1.1
    element 3.1.2
    element 3.1.3
    Subgroup 3.2
    element 3.2.1
    element 3.2.1

    Currently on v 3.07 and testing 3.1
     
  2. Jaanus

    Jaanus Super Moderator

    Level: Community
    Unfortunately no.
    As I know this would be something that the developers hope to implement some day but (if I am not wrong) nobody has yet ideas how.
     
  3. Jaanus

    Jaanus Super Moderator

    Level: Community
    Just for information and in idea-generating purposes -

    I have some ideas how it would be look in form level and how it principally should work. Assuming that at least as first steps nested groups would be allowed only for joined data. E.g if the joined group's parent ("from") table is not main table but another joined table then this groups data is displayed inside its parent group.
    Parent joined group ("from" table is main table) = 1
    Child joined group ("from" table is joined1) = 2
    Default (maybe even only possible) positioning - in regular form view 2 is always below 1, if 1 is repeat group and shown in table mode then data from 2 is always the rightest.

    Scenario 1.
    1 and 2 are both non-repeating - here is nothing to write.
    Scenario 2.
    1 is nonrepeat and 2 is repeat group. Data 1 is displayed as always (in list mode). Data 2 below could be or in list or table mode.

    Scenario 3 (+picture).
    1 is repeat group and 2 nonrepeat. The most interesting. Each repeating subroup of 1 displays the fields of 2 below or right side of own fields. Although 2 is nonrepeat, it repeats with the data of 1, taking needed pk value for its fk field from each row of 1 . When using table mode, the fields of 2 are equally <td>-s like fields of 1.
    repgroup_with_nonrepeat_in_repeat.png

    Scenario 4 (+picture).
    both 1 and 2 are repeat groups. Ressembling to the scenario 3, but the main difference occurs when we are using table mode. Repeat group 2 is inside the rightest table cell shown or in list or table mode. This column's heading is group label. If 2 is in table mode then its element headings are also shown.
    repgroup_with_repeat_in_repeat.png

    The most complex issue is how to make it possible in code level. No ideas could it be done only in template files or it needs some modifications in other files as views/forms/view.base.php or models/form.php

    I may be wrong but I believe that we could be able to divide the joined groups into 2 category by their main table and define them by these categories (NOTICE: the following is only to illustrate the logic, at least one part of variables doesn't exist in templates and the way I propose may be actually wrong in whatever reason).

    I imagine it so:

    - if group is just a group or is join and join_from_table is the main table
    -- we call it $group
    -- else we call it $nested_group
    OR
    - if group is join and join_from_table is not the main table
    -- we call it $nested_group
    -- else we call it $group

    The next things similar to that in default.php would happen in default_group.php and default_repeatgroup_row.php
    I give the simpler example - it's for default_group.php
    Before endforeach would be code something like this:

    PHP:
    if ($nested_group->join_from_table == $group->table_join)
    {
    $group = $nested_group;
    $this->elements = $group->elements;
    echo $this->loadTemplate($group->tmpl);
    }
    Well, that's all. Thank you for your attention :)
     
  4. zebrafilm

    zebrafilm Member

    Level: Community
    Jaanus, thank you for you answers and ideas. Indeed a warm welcome to my first post :)

    Bastiaan
     
  5. samani

    samani Member

    Level: Community
    hi @Jaanus. are you there after 7 years?
    can you give me more advise about code for implement repeating group inside other nonrepeating. something such as scenario 2.
    @zebrafilm please help if you have any experience.
    Thank you
     

Share This Page