how can i passing value to combobox in flex? - apache-flex

i have combobox in one screen(namely 1) and i need to pass the selected value of the combobox to the another combobox which is in the another screen(namely 2) and the passed value should be selected by default.

In simple terms (if both comboboxes have plain strings or same set of objects in their data providers):
combobox2.selectedItem = combobox1.selectedItem;
If that is not the case, you will have to get a mapping from items of first combobox to the second one.

Related

javafx treetableview cell value not getting updated

Event after updating the data model javafx treetableview cell value not getting updated.
I am using the sample code here # http://docs.oracle.com/javase/8/javafx/user-interface-tutorial/tree-table-view.htm
(Example 15-2)
On click of button i m trying to update first item: employees.get(0).setName("Test");
Is there any trick using which treetableview can be updated?
The example, somewhat strangely, returns a ReadOnlyStringWrapper wrapping the property values for the cell value factories. Thus instead of binding the value displayed in the column directly to the properties in the Employee class, it binds them to a new, read-only, property wrapping the value retrieved when updateItem(..) is called on the cell. This means it won't get updated when the underlying data is updated, but only if the updateItem(...) method is invoked on the cell. (I have no idea why they would do this.) So you should find, for example, that if you change the value, then collapse the root node in the TreeTableView and expand it again, that your new value is displayed after expanding the root (because this causes the cells' updateItem(...) methods to be invoked).
To make the cells update when the data is changed, bind the cell value directly to the property defined in the model (Employee) class:
empColumn.setCellValueFactory( param -> param.getValue().getValue().nameProperty());
and
emailColumn.setCellValueFactory( param -> param.getValue().getValue().emailProperty());

How to make custom combobox inside ASPxGridView

Is it possible to have combobox with 2 valuefields, other words, if we are inserting some columns, this combobox should give value to 2 columns. Hope its undersentable.
Is it possible to have combobox like this inside ASPxGridView?
Use this procedure:
1. Submit one combo box value
2. In ASPxGridView.RowInserting event use that value (retrieve it from e.NewValues) to fetch others.
3. Insert fetched values into e.NewValues.
This will work if you can fetch all row values using combo box value.

DevExpress RowUpdating old values returning text value

I have a DevExpress ASPXGridView which has been bound with a dataset.
I'm using the edit row command to edit the data in the row and return it to the database.
When the edit button is clicked, the row opens up and there is an ASPXComboBox that is bound to another dataset. The TextField and the ValueField have both been properly set in the ASPXComboBox and are displaying data correctly. The data is as shown
List item
List item
When e.NewValues("") is called the integer value field i.e 1 is returned. However, when e.OldValues("") the TextField is returned i.e. "List Item"
Is there a way of returning the the integer value when calling e.Oldvalues without having to make another call to the database?
Thanks

first value should be selected when loading the data in ComboBox

I had a comboBox and loading the datadynamically from the server. i need to display the first value in comboBox as a selected value and based on the value data should be populated on the grid. Please send me a sample example on the same if nay one knows.
thanks,
Ravi
You can select the first value by setting: selectedIndex=0 or set the selectedItemproperty.
But you should make sure that there is an item which you can select. This could be for example done in the setter of the dataProvider.
Another way to make sure that you have data is add a ChangeWatcher to the dataProvider, so that you will be notified when new data is bound. Then you can simply traverse the data and select whichever one you want, in your case selectedIndex=0;

Flex dataGrid how to color empty rows?

My problem is that empty rows (if there are more rows that dataSource items then there are empty rows) look identical to rows binded to dataSource items which are empty (see the difference?).
The only way to know the difference is to hover over them with the mouse, and if they are empty there's no color change, otherwise there's the blue background of the selection..
I want to change the color or in some way hide empty rows, those that are not bound to a dataSource item.
How can I accomplish this?
You can format your DataGrid using ItemRenderer.
The itemRenderer is a display object that get the data from the data provider and display it in the grid.
Writing your own logic can help your specific data display in general. in this case, check for data on the ItemRenderer object creationComplete. it the data is null or empty - display a sign (or whatever).
See this link as reference:
http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/
Enjoy!
I'm not sure if this is exactly what you are looking for but I cut off my rows at the end of my dataprovider like this:
myGrid.rowCount = myDP.length();
This can of course be modified with some simple logic to have min, max, or if it's a data entry type of grid length()+1.

Resources