list controls in flex3 - apache-flex

i’m new to RIA, Flex.
Currently i’m using Flex 3.
I have some difficulty in my work.
i have three lists and a button.
depending up on the selected items in first two list and after clicking the button i have to disply the items in details list.can any any one help me
thanks in advance
in first list iam displaying names of employees
in second list displaying managers names
then if i select one employee name and one managers name then after clicking button corresponding employee and managers details should be dispplayed in the third list.
this is my work
presently iam unable to post my code
the problem is with initialising the details list and dynamically changing it.

It sounds like your third "list" isn't going to be a list at all, it will be a DataGrid of some kind, or a form with key/value pairs for the common data each employee and manager share.
Presumably your employee and manager lists are populated from a database, and you get more data than the name with each data object. What you need to do is add an event listener which listens for the change event in each of your first two lists. Then you have an event handler that does something with the result. The following just concatenates all the data from each selectedItem (for our imaginary list1 and list2) and puts it into an ArrayCollection, which is then assigned as the dataProvider for a DataGrid named dg:
private function changeHandler(event:DataGridEvent) : void {
var list1Item:Object = list1.selectedItem;
var list2Item:Object = list2.selectedItem;
var ac:ArrayCollection = new ArrayCollection();
for (prop in list1Item) {
ac.addItem({prop:list1Item[prop]});
}
for (prop in list2Item) {
ac.addItem({prop:list2Item[prop]});
}
dg.dataProvider = ac;
}
This is obviously not how you are going to do this, but it serves as an example. More likely you will have certain properties that you are interested in showing, and those are the ones you will add to the dg dataProvider.
This is as helpful as I can be speaking generally, in the absence of specific descriptions and requirements.

Related

Is it possible to add values to table widget programmatically in Google Appmakers

I am able to show the data source data in google app maker table widget, but I don not know how to show static values (array of object) to table widgets programmatically.
I am new to app maker,I don not know is it possible to add values to table widget programmatically or not.
If any one knows please help me...
Thank you in advance :)
To call your own create children method you would want to set up a panel similar to the picture provided and set a datasource for that panel for which items you want to appear in that panel.
Then go to events for that panel and in the onDataLoad event enter the following code as it pertains to your own data. In my example I used a datasource called employees, and I created a label with the employee name for each item in the datasource.
widget.datasource.items.forEach(function(item) {
var node = document.createElement('div');
node.className = 'app-Label';
node.style.margin = '8px';
node.textContent = item.EmployeeName;
widget.getElement().appendChild(node);
});
That is about the simplest example I have. In the case of a table you would want to create your own base container, a header, and then a container that holds all your table rows. Then in your table body you would set up a similar script that attaches row panels and in the row panels you would create your labels. This would also be possible to declare your own array of objects and loop over each object this way.

Create keywords list WITHIN Create with MANY to MANY relation

I'd like to build a simple creation/edition system where one can create a Challenge that contains many Keywords. Here is the data I created:
Challenge <---- MANY to MANY -----> Keywords
Now, I'm struggling building my Challenge creation form because I'm trying to embed the keywords selection on the CREATE page of the challenge itself. Here is what it looks like:
Screenshot for Challenge creation
This is the Challenge creation page. It contains name, description (challenge model fields) and also a dropdown that goes with a grid, both dedicated to keywords for this challenge. Thanks to a script, I successfully add an keyword item to the Grid datasource when the user selects a value:
/**
* Adds a Keyword to the list of Keywords
* If already added then does nothing.
* #param {Widget} widget - widget that triggered the event.
* #param {Keyword} newValue - record object of selected keyword.
*/
function addKeyword(widget, newValue) {
var ds = app.pages.CreateChallenge.descendants.KeywordsGrid.datasource;
ds.items.push({
KeywordId: newValue._key,
KeywordName: newValue.Name
});
widget.value = null;
}
Once the keywords are added, my problem is that I don't know how to link the newly filled grid full of keywords to the New Challenge in creation so that it populates it with those keywords. Here is what it looks like on the Grid object:
Screenshot for grid
Can I achieve that with bindings only? Should I script it?
Any help is welcome. I guess my question is actually : how to bind a grid to an object in creation (and edition) on a relation between this object and other ones?
Finally solved it after hours. I used :
#datasources.Challenge.modes.create.item.ChallengeKeyword
It allows to handle the data for the item that is being processed by the creation "mode".

How to implement a JavaFX table with multiple TableViews and Cell Factories?

I have a table whose list of visible items are filtered by radio buttons at the top of the table. So let's say the radio buttons are A, B, C - if A if chosen the table will only show items of type A, if B is chosen it will show only type B, etc.
I create a separate TableView instance for each selection because the users will be interacting with these filtered values in the table and editing values etc. I have a custom cell factory for each column in my table as well because rows need to be highlighted/frozen according to user input.
So:
for (all values A.. C) {
createNewTableView();
}
private void createNewTableView() {
TableView tableView = new TableView();
...
MyCustomCellFactory customCF = new MyCustomCellFactory();
customCF.setTableView(tableView);
clmn1.setCellFactory(customCF);
...
}
My problem is that when my custom cell factory fires, even through I specifically tell it which instance of table view it belongs to, the table view instance is not the correct one. It's always just the last one I created. I've verified this by checking the instance id's.
So the question is how can I have multiple table view instances with custom cell factories and ensure that I'm always acting on the right one in my custom cell factory code?
Thanks!
The problem actually had to do with not properly instantiating the table columns for each instance of TableView. I posted a simpler example here - JavaFX tabbed pane with a table view on each tab? - and got the answer I needed.

Handling Click Events In MVVM Lite

I have a GridView and handle the click event in the Code-Behind as follows:
void ItemView_ItemClick(object sender, ItemClickEventArgs e)
{
int itemId = ((Location)e.ClickedItem).Id;
Frame.Navigate(typeof(SectionPage), itemId))
}
The data is populated from the ViewModel. I would like to handle this click event in the ViewModel instead of the View, but I've not been able to figure out how to do that.
In addition, I am employing a drill down scenario, where each time an item is clicked in the GridView, it results in a similar grid with different data. The ICollection<Location> simply repeats itself three times, populating each new grid with similar data.
Currently I am using three different identical Views and ViewModels to accomplish this. It seems to me there must be a way to do this using the same View. In other words, click on an item and the view re-populates itself with a new set of data, based on the item clicked.
The data is supplied from a WebService. To obtain the new data, a separate method must be called for each View, passing in the itemId of the previous data. I cannot do this with one method as the keys are not unique across all methods.

How to get data from dynmically created Treeview

I am using ComponentArt Third party controls for ASP.NET 2.0.
Here is the problem I am facing.
I created some ComponentArt.Web.UI.TreeView at runtime on Page_Load.
Now at click event of a button, I want to get values of the selected nodes in the treeview.
Can someone help?
Firstly I'm assuming you have MultipleSelectEnabled set to true to allow the selection of multiple nodes in the TreeView.
If you have that you can use the MultipleSelectedNodes property of the TreeView to get an array of TreeViewNodes.
From here you just need to iterate through the array and use the Value property of the nodes to get what you need.
So essentially something like this should work,
TreeViewNodes[] selectedNodes = treeViewID.MultipleSelectedNodes;
ArrayList values = new ArrayList(selectedNodes.Count);
foreach (TreeViewNode node in selectedNodes) {
values.Add(node.Value);
}
And now you have your selected node values in the ArrayList.

Resources