power-media / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

THtmlArea can't be updated in a callback #446

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
THtmlArea is not supposed to be updatable in a callback by itself, but it 
should be correctly updated if nested inside a TActivePanel rendered in a 
callback.

Example template:

<com:TActivePanel ID="panForArea">
    <com:THtmlArea ID="txtArea" Text="Template text" EnableViewState="true"/>   
</com:TActivePanel>
<com:TActiveButton ID="cmdTest" Text="change area text" OnCallback="cmdTest" />

Example code:

public function cmdTest($sender,$param)
{
    $reqnum=$this->getViewState('RN', 0);
    $reqnum++;
    $this->setViewState('RN', $reqnum);
    $this->txtArea->Text="hello; request #".$reqnum;
    $this->panForArea->render($param->NewWriter);
}

The htmlarea gets destroyed and recreated in the callback, but its content 
doesn't change as expected.

This was working before; the problem is due a to a regression introduced in 
r3117. 
This is what happens in the callback:
 1. the old TActivePanel div get replaced with the new content
 2. The old tinyMCE gets removed using mceRemoveControl
 3. mceRemoveControl updates the contents of the textarea with the tinyMCE contents, actually overwriting the newer content coming from the callback
 4. the new tinyMCE gets created

Since the mceRemoveControl behaviour can't be disabled, a simple workaround is 
to save the textarea contents before step 2 and re-apply it after step 3.

Original issue reported on code.google.com by ctrlal...@gmail.com on 6 Mar 2013 at 9:31

GoogleCodeExporter commented 8 years ago
fixed in r3277

Original comment by ctrlal...@gmail.com on 6 Mar 2013 at 9:32