Delphi For PHP Forums       


Go Back   Delphi-PHP Forums > Programming > Javascript and Ajax
Forum Jump Register FAQ Members List Downloads Search Today's Posts Mark Forums Read

Javascript and Ajax Questions and information about working with Ajax and Javascript in Delphi for PHP.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 16th January 2009, 12:48
just Joined!
 
Join Date: Jan 2009
Posts: 2
loshtar is on a distinguished road
Default Retaining dynamically inserted components

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 16th January 2009, 18:33
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,272
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

I think you need to use serialize() and unserialze() functions for that. Look at some of the other components and see how they use them.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 05:52.




Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 ©2009, Crawlability, Inc.
Copyright © 2004 - 2009, G&J Solutions Ltd. All Rights Reserved. terms of use