PDA

View Full Version : Dynamically expand forms



tarsolya
17 Apr 2007, 5:45 AM
Is there a way to add more elements to a Form after it's render called?

For example, one of my forms has a button with a callback that does this:


/*
... Form code, finishing with a render() ...
*/

// f is the Form
function fooCallback() {
f.start( f.column(1) );
newField = new Ext.form.TextField({
fieldLabel: 'Test',
name: 'Testfield',
width: 175,
value: 'testvalue'
});
f.add( newField );
f.end();
}

But nothing happens, when I press the button .. however, the code runs without errors (debugged in Firebug), but the field doesn't show up.

Calling render() twice throws some errors.

I have a property list, which I want to expand by user interactivity. PropertyGrid is not good this time, it has to be a form. Is this possible currently with Ext's Form?

Regards,
Andr

tarsolya
18 Apr 2007, 12:23 AM
No takers? :(

tryanDLS
18 Apr 2007, 8:56 AM
You could build them all initially, and hide certain ones til they're needed.

Illiarian
18 Apr 2007, 11:47 PM
You could build them all initially, and hide certain ones til they're needed.

That's not possible for some forms.

For example, you're adding contacts for various companies. You may need to add 2, 5 or 20 contacts at a time - you simply don't know.

tarsolya
19 Apr 2007, 2:22 AM
Exactly that is the problem what I have at the moment, Illiarian.

Still couldn't figure out what I could do, but I guess it's not supported currently. Would love to hear from an Ext dev about this :)

Regards,
Andr

efege
19 Apr 2007, 4:07 AM
I'm also planning to use Ext in an application --library cataloging (yes in the old sense of library, books and such things ;))-- where you never know in advance neither how many nor which data fields are going to be needed for each particular bibliographic record. You simply offer the user a large menu of available fields (http://www.loc.gov/marc/bibliographic/) (many of them indefinitely repeatable!), and let the form grow as needed.

In this situation, it is not practical to have a hidden monster form waiting to be partially un-hidden; rather you add/remove DOM nodes each time the user creates/deletes a data field.

Would be nice to add this capability to Ext...

cocorossello
24 Apr 2007, 12:30 AM
No way to expand forms after render!!!!

I think this functionality should be implemented too, at least i really need for my application....

phibix
22 Jun 2007, 3:57 PM
I posted a solution here:

http://extjs.com/forum/showthread.php?p=41022#post41022

Comma
25 Nov 2007, 12:57 PM
I posted a solution here:

http://extjs.com/forum/showthread.php?p=41022#post41022

ty