Fabrik / fabrik

Fabrik for Joomla 3.x
http://fabrikar.com
Other
254 stars 380 forks source link

Databasejoin + CCD List Filter Error #1411

Open MoleInc opened 9 years ago

MoleInc commented 9 years ago

I encountered an annoying JS error when in one list which had a Databasejoin that updated a CCD element as a filter (both are present as filters). It would infinitely loop (slowly) a AJAX request on the list data view that would fail, as due to whatever reasons (perhaps the where query on my CCD) it would return a Joomla database error instead of JSON. I believe the error is something to do with how I have my Databasejoin and CCD setup.

Heres a my Where query in the CCD for reference:

'{ff_events_fremantle_festival___festival_raw}' IN((SELECT festivals FROM {thistable}_repeat_festivals WHERE parent_id = {thistable}.id)) OR '3' IN((SELECT festivals FROM {thistable}_repeat_festivals WHERE parent_id = {thistable}.id))

Everything exists and everything works normally in forms and such. The value 3 in this case equals the value 'All' which is a actual entry in festivals.

Now all that aside, I made a workaround; not sure if this would ultimately be the correct fix or if the actual error is elsewhere. Regardless this worked for me with no apparent errors:

In: components/com_fabrik/models/list.php Added:

if (!$el) { return false; }

After line: 9746 $el = $listModel->getFormModel()->getElement($col);

This made it either return the proper 'false' it should have OR just fail gracefully; not knowing enough about how Fabrik's methods work I can't be sure. But now there's no more database error, so no more AJAX error loop and my filter works correctly and no huge JS error log.

trob commented 9 years ago

Can you please post in the forums? Errors in the network response can be seen with browser dev tools. You can't use "FROM {thistable}_repeat_festivals", {thistable} is a placeholder for a table alias

MoleInc commented 9 years ago

{thistable} works for me due to my naming scheme in this case, otherwise I would of just used the exact name.

Might post in the forums later then, I've got enough forum spam (not saying yours is though) to look after as it is.