CanDeleteRow run 4 times...

lcollong

FabriKant d'applications web
Hi,

I use this list plugin to check if a given row from a reference table could be deleted or not as it could be used in the data table to provide valuable linked informations.
Thus I use eval to check if the id is present or not in the foreign key columns of a pretty big table (select count(*) from huge_table where fk_ref=X). But the sql is triggered 4 times for each row.

Could you confirm ? Wouldn't produce heavy sql load ?

edit : the number of times the code is run increase with the number of rows in the reference tables (the one where the plugin is).
 
Last edited:
And just to explain that, we have to run it on every row during display of the table, so (among other things) we know whether to show the delete X on that row or not.

-- hugh
 
Yes. Sounds logical. Also triggered on the form view as the "delete" button could be there. However, one may think that it should not if the button is not available.
As a related thing, I use $id = '{table___id}' to catch the current row on which the plugin is activated in order to build the SQL that will check if nothing is related to it. However, using the "form add" I get an error as the placeholded is not set :
Code:
Notice: Undefined property: stdClass::$table___id in /home/xxxxx/www/xxxxx/plugins/fabrik_list/candeleterow/candeleterow.php on line 73
Is there a way to check if the "candeleterow" plugin is run in a "new" context ? thus avoiding to catch the id ?
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top