QPanel AfterRender() Method Available?

Login or register to post comments
6 replies [Last post]
profnotime's picture
Offline
Joined: 01/13/2009

Please I need to execute a method after my panel has been successfully rendered but before my form exits. Is there a QPanel AfterRender Method? How do I go about this please.

--
@Tribute: R.I.P M.J.

agsel's picture
Offline
Joined: 04/02/2008

you might do:

<?php
class YourPanel extends QPanel {
  ...
  public function
Render($blnDisplayOutput = true) {
   
$strHtml = parent::Render($blnDisplayOutput);
   
$this->CallToYourMethod();
    return
$strHtml;
  }
}
?>

profnotime's picture
Offline
Joined: 01/13/2009

Thanks agsel. Let me try this.

profnotime's picture
Offline
Joined: 01/13/2009

but Agsel, I was thinking that the $blnDisplayOutput was to control whether the output is immediately rendered or returned. From your code, I see that you returned the rendered output from the parent::Render() call to the variable $strHtml. With that, is the $blnDisplayOutput variable not supposed to be false? Please clarify me on this.

Regards Agsel.

agsel's picture
Offline
Joined: 04/02/2008

Well, it's true. If $blnDisplayOutput is true, then html is printed to the output and nothing is returned, eg $strHtml = null. So, it might be somewhat clearer, if you checked the value of $blnDisplayOutput and return $strHtml only when there output should be returned. eg the last line of Render method should be:

<?php
if (!$blnDisplayOutput) return $strHtml;
?>

parent::Render() will do printing for you if needed (if $blnDisplayOutput == true)

OOPMan's picture
Offline
Joined: 11/07/2008

Hi, this is almost correct. However, writing your method as such causes the Override-At-Render functionality to stop working. The following works better...

public function Render($blnDisplayOutput = true)
{
$this->RenderHelper(func_get_args(), __FUNCTION__);
$strHtml = parent::Render($blnDisplayOutput);
$this->PostOps();
return $strHtml;
}

profnotime's picture
Offline
Joined: 01/13/2009

I am most grateful for the touch up OOPMan. Thanks so so much.