flex tab navigator - apache-flex

I have a flex application mxml file with 3 tabs.the first tab having the link button to select the value in the 3rd tab.
Suppose, i have a link button in first atab. And the 3rd tab contains the combobox with values:"basic", "advanced". by default the vaule is displaying "default".
Wheni select the linkbutton on the first tab, the "advanced"should be displayed in the comboBox on the 3rd tab.
and the problem is , when click on the first tab link button , at that time the 3rd tab is not initialized.So it is not displaying the "advanced" in the comboBox. selecting the 2nd time on the link button it is displaying fine. But not first time.
code: thirdTab.comboBoxId.selectedItem.data = 1;
Please help me out if need any changes

A tab is initialized when it is activated the first time, so your code should not work.
You can separate data model and bind all the UI controls to the model.

Add an event listener to the 3rd tab that is handled by the parent of the TabNavigator. The handler for that event should be able to get the value from the first tab (which may be stored in the common parent) and return it to the 3rd tab so that the ComboBox there may be correctly set. Listen for the creationComplete event from the 3rd tab.

The dirty way is setting the creationPolicy property of your tab navigator to ContainerCreationPolicy.ALL. This will insure that all the tabs are initialized at once.
The right way is separating the model from the view and using binding as Yuras says.

Related

How to make pop-up data reflect selected record?

The case:
I have Activities as datamodel.
I have set Activities to have many-to-many relationship with themselves to represent a Parent / Child relationship.
I have set up an accordion widget. Each row of the accordion contain basic data about the Activity record + some buttons.
I have set one of the button's onClick functions to open a popup, which allows me to edit the Activity detail in a form.
When I click a different record from the same accordion, the form from the popup reflects the data in the selected record.
The problem:
I have nested accordions which represent the "Child" Activities of the Parent Activity.
I have also added a similar button, which opens a popup. I can open the popup, which targets the child records, but cannot make it open the specific record, from which I pressed the button.
So the popup open by default on the first child.
Please help - how can I make the popup change naturally to reflect the datasource / selected record of even nested datasources?
What I tried:
In order to try and make to popup work I have tried to set the datasource based on the relationship:
Activities: Sub_Activities(relation)
This works to the extent of showing the related items, but popup content does not dynamically change on clicking a different child record or clicking the button from a different child record.
In both cases what is shown is the first child record.
What I understand is that you have a set up in which you click a button and a popup shows. The popup should let you view/edit the record referenced in the row where the button is. If that is the case, then probably you already have almost everything setup for the next thing to work. First, add a string custom property to the popup and name it selectedKey. Then, on the onClick event of the button that opens the popup, add something like this:
var key = widget.datasource.item._key;
app.popups.MYPOPUP.properties.selectedKey = key;
app.popups.MYPOPUP.visible = true;
Now, go to the popup content and add the following on the onAttach event handler:
var key = widget.root.properties.selectedKey;
widget.datasource.selectKey(key);
This is the general idea of how to make it work; However, in order for it to work, your datsources in the widgets should be properly set up. Good luck!

list window does not disapper of Obout ComboBox control

I am developing a web application. I used ajax Update panel & under update panel I used gridview for displaying data. In gridviews edit template I used three Obout ComboBox Control(third party) and bind the data from database.for moving one control to another controls I am using tab key.I used tab key from one combobox its move on second combobox when its move then it is displaying list window of combobox it wont disappear after I go to next control and also when I save the data it well display list of comboxBox.
For example of marked comboBox I attached two images
1)”” when I move one comboBox to another comboBox it is displaying list
2)”” when I save the data it is displaying list window of comboBox.
But when I remove the update panel it won't display such list after focus is moved.
Note:When I use mouse to move one comboBox to another comboBox, list window of ComboBox wont come on screen.
VS:2010
Code-Behind:VB.net
Obout Suite Version:3.5
using obout comboBox property openOnfoucs="false" , solved the problem. It does not display list window when focus moved to another control.

Flex: ItemEditor losing focus!

Here's an image of what my problem is:
I am using a combo-box as a Datagrid ItemEditor (Not just Renderer, my Renderer is a Label, double clicking on a cell makes the combo-box visible, as is the case with all item editors)
Now, selecting one of the entries in the combo-box is no problem. But my problem is only when i select the "Fruit" , which in turn pops open another layer called "Select Fruit" dialog
Questions:
How do i keep item editor, while the focus is on the layer; right now as soon as i click on the fruit , my handler popsup the "Select Fruit" dialog and the focus is on the layer. Once the focus goes out of the editor, the ItemEditor goes away and ItemRenderer label comes back.
I want to keep the ItemEditor alive! where do I hook up interms of events like begin/end ItemEdit etc?
You can keep your itemEditor alive by listening for DataGridEvent.ITEM_EDIT_END. Then you have a lot more control to do what you want. Some FYI from my blog:
DataGridEvent.ITEM_EDIT_END
- Dispatched when focus is removed from the cell
- List-based control’s default event listener will
1) use the .editorDataFrield property to deterine the property of the item editor to store the edited data; In a default TextInput control’s item editor, the “text” property would contain the new data.
2) Invoke destoryItemEditor() depending on the reason of the event
You can interrupt the default List-based control’s default event listener by using event.preventDefault() to
a) Modify the data returned from the item editor
b) Examine/Validate the data entered into the item editor; If the data is incorrect, you can halt Flex passing the data back from the item editor into the list-based control
http://knowledge.lapasa.net/?p=153
Try losing focus of your ItemEditor. Goto Combo Box Change Listener
protected function comboBox_changeHandler(event:ListEvent):void
{
// set focus out event on datagrid. Its like clicking outside the datagrid
event.target.parent.parent.parent.dispatchEvent(new FocusEvent(FocusEvent.FOCUS_OUT);
}

Toggle viewstack within child component

I have a viewstack with two tabs.
In one of them there is a data grid shows a list of notes. The other one is includes a form that can edit notes or crates new note. I want the user to be able to add new note or edit existing note when clicks an item in data grid. I mean when user clicks an item the viewstack must become editor.
You can use the "selectedIndex" or "selectedItem" property on the viewstack to switch the active view. In your case, an event should be dispatched that bubbles up to the component containing the viewstack. When it arrives, the viewstack's active view can then be changed.

Flex 4 Inline Item Editor Wiping Out Data

In this app that has an inline item editor, if you click on a location cell then press tab, the value in the location cell is wiped out.
focusOut doesn't work, nor could I get this to work in DataGrid itemEditEnding etc.
See this Flex forums post, because posting code here rots:
http://forums.adobe.com/thread/778496
The definition for the inline item editor needs this:
selectedItem="{data.location}"
instead of this:
prompt="{data.location}"
This is because the itemEditEnd event sets the newData property (deep within the code) to the value of selectedItem, so if you have only selected the cell and have not yet selected a value in the DropDownList, such as selecting the cell then immediately tabbing out, the value gets wiped out.

Resources