[Solution] calc field as group-by in list

Sophist

Guest
I am trying to use a calc field (one character) as a list group-by field and to use the same field's placeholder in the front-end template box to display the calc on the summary row.

The calc field is stored as a text field in the database, and the group-by seems to work on it, however the front-end box doesn't seem to work with the text field's placeholder (it works with varchar fields).

Any one got any idea how to fix this?

Thanks.

P
 
I am assuming that it is somewhere in components/com_fabrik/models/list.php method formatData in code:

Code:
if (!in_array($sdata, $aGroupTitles))
{
    $aGroupTitles[] = $sdata;
    $grouptemplate = ($w->parseMessageForPlaceHolder($groupTemplate, JArrayHelper::fromObject($data[$i])));
    $this->groupTemplates[$sdata] = nl2br($grouptemplate);
    $groupedData[$sdata] = array();
}

but I am too new at Fabrik code to know what exactly the problem is or how to fix it.
 
Ok - I have fixed this. Essentially...

When you group a list on a calculated field (which is stored in the database as a text type) or on a linked field, the groupby row displayed is missing the group-by value or the anchor is screwed up by the link.

These are caused by use of non-raw placeholders. Also, code seems to be much more complicated than it needs to be - it gets the group-by clause used to get the data and it can use this for processing.

This fix simplifies the code (until it has been reviewed, old code has been commented out rather than removed) and makes it work as advertised.

Added to GitHub as PR-747. I have uploaded the file here in case anyone wants it. It should be applied after installing 3.1b package AND applying the current Joomla3 branch (as at today) from GitHub.

P
 

Attachments

  • list.php.txt
    301.4 KB · Views: 1,822
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top