Using [Link to Details] breaks Group By table formatting

janon

New Member
Attached some screenshots to save some words. Basically renderListData is being called before the actual grouping logic begins, but with Link to Details enabled the field becomes unique by converting it to an html link first and breaks the logic. While I'm talking about Group By, the toggle to hide group sections is broke also, it ends up clicking/following the "#" href tag in the toggle img which ends up reloading the page.
 

Attachments

  • Table-1.png
    Table-1.png
    18.2 KB · Views: 244
  • Table-2.png
    Table-2.png
    26.3 KB · Views: 245
  • Table-3.png
    Table-3.png
    23.5 KB · Views: 243
Yeah it looks like some work to roll in a good fix. In case anybody else just needs a bandaid I'm using this:

File: ..\components\com_fabrik\models\list.php
Starting at line: 687

Code:
[SIZE="2"]
if (isset($data[$i]->$groupBy))
{
 $sdata = strip_tags($data[$i]->$groupBy);
 if (!in_array($sdata, $aGroupTitles))
 {
  $aGroupTitles[] = $sdata;
  $grouptemplate = strip_tags($w->parseMessageForPlaceHolder($groupTemplate, JArrayHelper::fromObject($data[$i])));
  $this->grouptemplates[$sdata] = nl2br($grouptemplate);
  $groupedData[$sdata] = array();
 }
  $data[$i]->_groupId = $sdata;
  $gKey = $sdata;

 ...[/SIZE]
 
As for fixing the Grouped By show/hide toggler problem

File: ../media/com_fabrik/js/list.js

Code:
[SIZE="2"]var FbGroupedToggler = new Class({
..
Change:	  	
 container.addEvent('[B]mouseup[/B]:relay(.fabrik_groupheading a.toggle)', ...
To:    
 container.addEvent('[B]click[/B]:relay(.fabrik_groupheading a.toggle)', ...[/SIZE]

If mouseup is needed then handle the click event:

Code:
var FbGroupedToggler = new Class({
	initialize: function (container) {
		container.addEvent('mouseup:relay(.fabrik_groupheading a.toggle)', function (e) {
			...
		});
		[B][COLOR="DarkGreen"]container.addEvent('click:relay(.fabrik_groupheading a.toggle)', function (e) {
		  e.stop();
		  return false;
		})[/COLOR];[/B]
	}
});


Click event will still happen after mouseup, which the browser does its default business and follows the 'blank' href "#" in the anchor, causing a page reload. Didn't see any drag-drop references where mouseup would be needed.:confused:
 
NOTE TO SELF:

issue is in main list model formatData(), these lines:

[/php] // $$$ rob commenting this out as if you group on a date then the group by value doesnt correspond
// to the keys found in the calculation array

//see if we can use a raw value instead
/*if (!empty($data) && array_key_exists($groupBy . "_raw", $data[0])) {
$groupBy = $groupBy . "_raw";
}*/[/php]

... so need to work out how to groupBy the _raw data without screwing up 'split' calculations.

-- hugh
 
@janon - any chance you can get a github account, so you can submit changes as pull requests on a fork of the git master?

Just makes life 10x easier for us to a) make a judgement on the suggested changes (being able to see the context of the diffs) and b) merge the change if it's OK.

-- hugh
 
Already have an account, I sent you a pm awhile ago to change my username here to match my github's. I did forum post from work ;D, I'll merge it and do a pull request in a little bit once I get home.
 
Git shows @@ -686,15 +686,16 @@ class FabrikFEModelList extends JModelForm {
Fresh fabrik\master pull, not sure whats up with 738 :confused:
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top