Pivot list plug-in not summing anymore with custom links due to data-rowid

PaulV888

Member
Hi,

I just updated a site and my pivot table list plugins are not working as expected anymore. If I use custom element links on my pivot tables (so the user can click and see the details of the where the data came from), then the pivot is recognizing the same groups anymore.
On investigation I see the custom element link code is changed and now is automatically including the data-rowid in the link, which causes every row to be unique.

Assuming that this is desired for other area's, I suggest that we strip 'data-rowid='123'" back out, just for the pivot plugin.

Suggested code change in /plugins/fabrik_list/pivot/pivot.php, insert following lines at the beginning of onLoadData, line 249.
Code:
                // Remove data-rowid's
                foreach ($data as $groupKey => $group)
                {
                        foreach ($group as $rowKey => $row)
                        {
                                $data[$groupKey][$rowKey]->$yCol = preg_replace('/ data\-rowid="\d+" /',' ', $row->$yCol);
                                $data[$groupKey][$rowKey]->$xCol = preg_replace('/ data\-rowid="\d+" /',' ', $row->$xCol);
                        }
                }

If you guys agree with this change, i'll be happy to submit a pull request.

Thanks,
Paul
 
Just so I can better understand, are you using an element which has a custom link as one of the X or Y pivot columns?

-- hugh
 
Hmmm. Although that would work, I think rather than modifying that code, what I'd rather do is make the code that builds that a link a layout, so you can override it on the usual global / per template basis, and just remove the data-rowid.

I've been meaning to move that into a layout for a while, so people can do Funky Stuff with their links (like making them buttons).

https://github.com/Fabrik/fabrik/commit/b8561c4bc24960a7ae537dcaba18c8e6443608bb

So, you can copy that file to any of the usual layout override locations, like

./components/com_fabrik/views/list/tmpl/<your list template>/layouts/element
./.templates/<your site template>/html/com_fabrik/layouts/element

... and remove the data-rowid

I'm working on allowing a per-element name override. I just committed a way of doing it, but just because of the way layout paths get built, and because this is calling an element layout from the list model, the path is kinda funky, with an extra /element on the end ...

./components/com_fabrik/views/list/tmpl/<your list template>/layouts/element/<yourelement___fullname>/element

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top