PDA

View Full Version : Add a new form



jop_008
2 Aug 2012, 9:22 AM
Hi,

I have a form which must be processed and then another form must be presented with new title at top of screen, and buttons under the form.

I have it like this:

<formpanel> // stored in oformpanel
<title panel>
<form panel>
<buttons>
</formpanel>

I want another form loaded with new title and other buttons.

I try it like this:

get the panel with Componentquery
get the buttons with Componentquery
oform.hide (); // hides the form if I remove the form and don't hide it it is still visible
oformpanel.remove (titlecomponent)
oformpanel.remove (formcomponent) // when I remove containers from the panel nothing happes how can the screen be refreshed?
oformpanel.remove (buttoncomponent)

I create a new form with Ext.create and add it like this oformpanel.add () but nothing is happening.
I played also with show but same result (empty screen)

John

estesbubba
2 Aug 2012, 9:53 AM
From looking at your posts it sounds like you are struggling with the basics. Have you gone through the guides? Another great way to learn is look at the example source code.

http://docs.sencha.com/touch/2-0/#!/guide

You don't want to be removing titles, forms, buttons and then adding new pieces everywhere. It's a lot easier and cleaner to have a parent container with a card layout (or navigation view). That way each view (form, title, buttons) can be pushed into the container and the entire contents will be replaced. You can destroy your old view if it won't be needed again (like Back button).

jop_008
3 Aug 2012, 3:12 AM
Thans for the help. I have read a great number of docu but this is apparently not enough.
I switch to the card layout and used setActiveItem () but setActiveItem I could not find in the documentation at http://docs.sencha.com/touch/2-0/#!/api/Ext.layout.Card
So issue solved but understanding the API?

John

estesbubba
3 Aug 2012, 5:27 AM
A container has a layout (which yours is a CardLayout). It's the container that you call setActiveItem().

http://docs.sencha.com/touch/2-0/#!/api/Ext.Container

jop_008
3 Aug 2012, 8:06 AM
Thanks for your help indeed it is a method of the holding container. Stupid me.

Since you are an expert and willing to help. Maybe you can take a look at this post (http://www.sencha.com/forum/showthread.php?234875-Getting-radio-field-value-from-a-form)
It is about getting the value of a radio button from a form. I tried several things and played with getvalues.

John