Dynamic caption detail table

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
sangnandar
User
Posts: 980

Dynamic caption detail table

Post by sangnandar »

I'm on List Page of a master-detail.
Can I change the caption of detail table dynamically on each row?


arbei
User
Posts: 9286

Post by arbei »

You can update the field caption of the field in any of the server event.

For example in Page_Load Server Event of the detail table.

$this-><Field>->setFldCaption("<New Caption>");

Check the cField class in phpfn13.php for more information.


sangnandar
User
Posts: 980

Post by sangnandar »

Not the field caption but (detail) table caption.
Example:
On List page,
Row 1:
(detail) table caption = "sometext"
Row 2:
(detail) table caption = "another_sometext"
Row 3:
and so on.

This code works on Language_Load server event:
$this->setTablePhrase("<detailtable>", "TblCaption", "sometext");
But this change is for ALL row.
I need something like this but for each row.

Thanks.


rrezende
User
Posts: 15

Post by rrezende »

Try, In view page master

function Page_DataRendering(&$header) {
Language()->setTablePhrase("<detailtable>", "TblCaption", "sometext");
}


sangnandar
User
Posts: 980

Post by sangnandar »

Old topic and already had the solution.
The proper solution would be to hide the actual detail-table button from master List Page.
Then create another button to replace that button with ListOptions_Load() and ListOptions_Rendered().
Then run condition against a value in master-table's field, and based on that result adjust the link on ListOptions_Rendered().

This way I then had:

  1. A master table with multiple detail table.
  2. A column in master List Page, behave like detail-table button column, but with dynamic link, that point to a different detail table, that depend on a value on master table field.

No need to run setTablePhrase() at all.


rrezende
User
Posts: 15

Post by rrezende »

Ok, what explained works for the list page, the solution I posted, works for the view master / detail page with multiple details.

ListOptions_Load () and ListOptions_Rendered (), do not exist in the view page


Post Reply