Hi,
I have a panel that is populated dynamically with a component, below is the loop that does it:
Code:
function SearchButtonClick($sender, $params)
{
$sql = "select * from test_table";
$this->SearchQuery->setSQL( $sql );
$this->SearchQuery->open();
$this->SearchQuery->first();
while( !$this->SearchQuery->EOF ){
$this->SearchQuery->next();
$name = $this->SearchQuery->fieldget( 'name' );
$key = $this->SearchQuery->fieldget( 'key_' );
$acBox = new ActBox();
$acBox->set_AName( $name );
$acBox->set_AID( $key );
$this->ResPanel->insertComponent( $acBox );
$acBox->Parent=$this->ResPanel;
}
}
ResPanel is the parent, and "acBox" is the name for the dynamically added components.
ActBox is a simple custom component that I created that just outputs an HTML table.
This all works fine, but on any subsequent form submission, or ajax call, those dynamically added components disappear.
I actually found a "hack" solution for this by storing them in a published property array, and re-inserting them into the ResPanel on each ajax call, etc, but I would like to find a true solution in whicH I do not have to manually manage these dynamically added components.
Thanks
Loshtar