Page 1 of 1

block__ methods not called for child tables?

PostPosted: Tue Mar 02, 2010 1:31 pm
by rugcutter
Going from a previous example, I have two tables in my application. The project_mstr table is a parent table, and project_agreements is a child table that has a foreign key column "pa_project_id" that links back to the project_mstr table.

I set up the relationships.ini for project_mstr as follows:

Code: Select all
[Agreements]
project_agreements.pa_project_id = "$pm_project_id"



What is curious is, when I implement certain block__ methods within the delegate class for the child table (in this case, project_agreements) - they don't seem to be invoked. However when I implement them for the parent table (in this case, project_mstr), it works as designed.

Specifically, I'm trying to set up the block__custom_javascripts() block. Some sample code:

Code: Select all
    function block__custom_javascripts()
   {
      echo '<script src="js/myjavascript.js" type="text/javascript" language="javascript"></script>';
      echo 'STOPPING THE RESPONSE NOW';
      exit;
   }


For the parent table, the browser shows "STOPPING THE RESPONSE NOW" but for the child table the browser paints the page as if the method was not implemented at all.

Is there another way I should be including my child-table specific javascripts?

Re: block__ methods not called for child tables?

PostPosted: Wed Mar 03, 2010 3:38 pm
by shannah
Did you implement this block in your application delegate class or one of your table's delegate classes?

Re: block__ methods not called for child tables?

PostPosted: Thu Mar 04, 2010 8:03 am
by rugcutter
Hi Steve -

There are three places where I tried implementing the block:

* Application Delegate Class = Works
* Parent Table Delegate Class = Works
* Child Table Delegate Class = Does not work


Thanks in advance!

Re: block__ methods not called for child tables?

PostPosted: Thu Mar 04, 2010 5:46 pm
by shannah
Actually that is the correct behavior. Blocks defined in delegate classes generally only apply if the the current table (i.e. the table specified by -table) is for that delegate class.