repeat groups showing multiple <li> lines on list

skyrun

Active Member
on this list, displayed with bootstrap layout, i have a db join elements 'made up of' and 'owner' (and several others not displayed on the list)

when there is data (for example below, there are 2 owners), then display works fine. however if there is an empty repeating group for the element (see made up of for example), it appears to be displaying an empty <li></li>for each row returned by the list query. so if there are 2 owners and 4 of some other repeating group and 10 of some other, i get 2x4x10=80 rows of separator lines.
upload_2018-10-3_8-25-33.png
is this something best fixed by copying the bootstrap template and removing list display on the use-case of no data for the column/element? something that should be repaired generally?
 

Attachments

  • upload_2018-10-3_8-22-2.png
    upload_2018-10-3_8-22-2.png
    80.4 KB · Views: 393
sorry, i didn't mention that this was already set that way.

i think it's working that way too except in the case there is no data to display. that's when it displays:
<li></li>
<li></li>
<li></li>
...etc...
which with the template options set the way i have them with a separator (or perhaps that's in my .css), it displays 80 separator lines. so i think what needs to happen is that n the case with no data, don't put in <li></li> pairs.
 
Hmm. "Reduce data" should remove duplicates before it formats into a UL, which should include empty data.

I'll have a look, see if I can replicate.

-- hugh
 
were you able to find this? it's still happening on the latest build.

in default_row.php, $this->_row->data->$heading is the UL part of this:
HTML:
<td class="srms_virtual_units___sub_property_id fabrik_element fabrik_list_38_group_81 repeat-reduce">
        <ul class="fabrikRepeatData"><li></li><li></li></ul> 
 </td>
which is putting in padding and reserving space even though there is nothing between <li> and </li>

where is the html for the repeat group ($this->_row->data->$heading, which is what has the <li></li> in it) created? i could create a custom template, however i'm not finding where the <li>'s are being inserted.
 
Are there really no records in this repeating group?
Or do you have records with only the "Made of" element empty?
 
no records. virt prop is the tab name for these. no records in the db either.

the number of <li>'s is determined by multiplying all of the other joined repeating elements (there are 4 on this list. owners, virt prop, bedrooms, bathrooms are all repeating groups). as long as there is at least one record in the repeat group, it formats correctly (removing the dupes) but if the repeating group is empty, it puts in an empty <li> for (in the case of virt prop which is 'made up of' on the list) # owners * # bedrooms * # bathrooms
upload_2018-10-16_13-10-46.png

do you know where the <li>'s are created? is it a modifiable file? (ie in the template?).
 
There's a layout file
components\com_fabrik\layouts\element\fabrik-element-elementlist-details.php
which seems to do the list rendering in some cases (e.g. for dbjoin and yesno elements but not for id or field):confused:
 
perfect, thanks.

i fixed it by changing line 13 of that file to:
PHP:
    $condensedHTML = '';
    foreach ($condensed as $repeatitem) {
        if ($repeatitem!='') $condensedHTML .= '<li>'.$repeatitem.'</li>';
    };

    echo $d->addHtml ? '<ul class="fabrikRepeatData">' . $condensedHTML . '</ul>' : implode(' ', $condensed);

would be nice to get that in the base code, but i think i can put the override file into the template for now.
 
actually. i don't think you can override a fabrik core file in the template now that i think about it. is there a suggested way to incorporate this change into the base code. i think it only removes any blank <li></li> pairs without data. can't imagine a usecase where you would want to display the empty list item... but who knows.
 
it's a layout file which can be overridden by copying it to special locations, e.g. html/... in your Joomla template.
Details are somewhere in the WIKI

Gesendet von meinem SM-G930F mit Tapatalk
 
i think i tried that, but it didn't seem to override. i put it in TEMPLATE/html/com_fabrik/layouts/element
should it be somewhere else?
 
i'm having to update this file with my updated file after each fabrik update.
would be nice to include this change in this file in a future fabrik release if that would be possible.
 
fyi, to make this hack to remove all of the <li>'s on empty fields for other types of elements (this is for fileupload and i'm not sure what other element types), put the same mod above into file models/elements.php to remove the <li>'s unless there is data there.

still hoping to have this included in fabrik base code OR to figure out how to make it a permant override. my update script now has to copy my hacked versions over any updates.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top