1. "Fabrik 4" helpers needed!

    You are invited to join other community members active in coding, maintaining and improving Fabrik. Please visit https://fabrik.help for more information!
    Dismiss Notice

One icon in the list to view more data

Discussion in 'Community' started by enrb, Nov 25, 2021.

  1. enrb

    enrb Member

    Level: Community
    Good morning,

    I have a list with a non-repeating group linked to a repeating group.

    I want to show an element of the repeated group in the list, but instead of showing all the items, I would like to show only one icon (only one for all the items), is it possible?

    At the moment if I replace the text with the icon, in the list it shows me as many icons as there are items ...
     
  2. juuser

    juuser Well-Known Member

    Level: Community
    You can add something like this in your Fabrik list's custom css file:
    Code (Text):
    td.repeat-icon-trunc > ul.fabrikRepeatData li, span.repeat-icon-trunc > ul.fabrikRepeatData li  {
        display:none;
    }

    td.repeat-icon-trunc > ul.fabrikRepeatData li:nth-child(1), span.repeat-icon-trunc > ul.fabrikRepeatData li:nth-child(1) {
        display: list-item;
        border-bottom: 0px!important;
    }

    td.repeat-icon-trunc > a > img, span.repeat-icon-trunc > a > img {
        display: inline!important;
    }
    Last rule might not be needed depending how your other css looks like.

    And now, in the element settings, List view settings -> CSS, add "repeat-icon-trunc" in the "Cell class" field.

    And if you need a tooltip data from all the repeat rows, you can add evel'ed tooltip to the element and query the data from all the related rows from repeat table.
     
  3. troester

    troester Well-Known Member Staff Member

    Level: Community
    What do you want to do with this icon?
    If you want to show the repeatgroup data "on click": do you know list's "Related data" feature?
     
  4. enrb

    enrb Member

    Level: Community
    Hello, I know the "Related data" function, but that's not what I need.

    I'm just trying to use an icon in the list where, by hovering over it with the mouse, you can see in the popup that appears, the list of all the repeated data.

    I tried with a query in the calc element, but it only shows me the first element it finds and not all of them.

    I write below the query I use, do you have any suggestions to give me to ensure that I can view all the data?

    Code (Text):
    $db = FabrikWorker::getDbo();
    $query = $db->getQuery(true);

    $query->clear()
      ->select('dkgest_tavole_17_repeat.coddeltaassiemi')
      ->from($db->quoteName('dkgest_tavole'))
      ->innerjoin($db->quoteName('dkgest_tavole_17_repeat') . ' ON ' . $db->quoteName('dkgest_tavole.id') . ' = ' . $db->quoteName('dkgest_tavole_17_repeat.parent_id'))
      ->where(array(
        $db->quoteName('dkgest_tavole.id') . ' = ' . $db->quote('{dkgest_tavole_17_repeat___parent_id}')
      ));

    $db->setQuery($query);
    $count = $db->loadResult();
    return $count;
     
  5. juuser

    juuser Well-Known Member

    Level: Community
    Something like this should do:
    Code (Text):
    $mydb = JFactory::getDBO();
    $mydb->setQuery("SELECT a.coddeltaassiemi FROM dkgest_tavole_17_repeat AS a LEFT JOIN dkgest_tavole AS b ON a.parent_id = b.id WHERE a.parent_id = '{rowid}' ");
    $rows = $mydb->loadObjectList();

    $myhtml = "";
    foreach ($rows as $row) {
       $myhtml .= $row->coddeltaassiemi."<br>";
    }
    return $myhtml;
     
  6. enrb

    enrb Member

    Level: Community
    Thanks a lot juuser !! Your help was great!

    :):):)
     

Share This Page