Database driven combobox itemrenderer in DataGrid

Hi
I created a database driven combobox itemrenderer, code see below:
The data is loaded and shown correctly, but when I change the combobox, suddenly a "0" appears:
I can see in the debugger in combobox1_changeHandler, that the correct data is taken from the combo "this.selectedItem.data=3;" and written to "data.professionGroup", (changed from "1" to "3")
but then when the code jumps to set data the "value.professionGroup" is "0"?!?!
Thank yor for any pointers!
The DataGrid:
    <mx:DataGrid id="personDg" dataProvider="{sm.persons}" width="100%" height="100%" editable="true">
         <mx:columns>
            <mx:DataGridColumn headerText="firstName" dataField="firstName"/>
             <mx:DataGridColumn headerText="lastName" dataField="lastName"/>
             <mx:DataGridColumn headerText="professionGroup" dataField="professionGroup" editable="true" editorDataField="data"
                 rendererIsEditor="true"
                 itemRenderer="com.xxx.view.components.combobox.ProfessionGroupCombo">
             </mx:DataGridColumn>
        </mx:columns>
     </mx:DataGrid>
The ItemRenderer:
<?xml version="1.0" encoding="utf-8"?>
<mx:ComboBox xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo"
     change="combobox1_changeHandler(event)"  initialize="combobox1_initializeHandler(event)" >
         <fx:Script>
             <![CDATA[
                 import mx.controls.dataGridClasses.DataGridListData;
                 import com.myfim.model.ShellModell;
                   import mx.events.ListEvent;
                    import mx.events.FlexEvent;
                 [Bindable]
                 private static var sm:ShellModell=ShellModell.getInstance();
                    public function setSelectedItemByValue(val:int):void{                                                                   
                         this.selectedIndex = -1; // Show prompt if value is not found
                         for (var i:int=0;i<this.dataProvider.length;i++){
                            if(this.dataProvider[i].data == val){
                                 this.selectedIndex = i;
                                 break;
                         }// for
                 override public function set data(value:Object):void{
                    super.data=value; // value is the VO!
                     setSelectedItemByValue(value.professionGroup);
                 protected function combobox1_changeHandler(event:ListEvent):void
                    data.professionGroup=this.selectedItem.data;                   
                    // I can see in the debugger that "data.professionGroup" gets the correct data f.e. ="3" , but if it jumps to the "set data" the                          value.professionGroup is "0" !??     
                protected function combobox1_initializeHandler(event:FlexEvent):void
                    this.dataProvider=sm.comboData.professionGroupAc;  // AC of (label, data)
             ]]>
         </fx:Script>
</mx:ComboBox>

Hi,
yupiiee! I found the answer by myself, I had to change
editorDataField="data" to editorDataField="value"
Thats all! Then it works!
Martin Zach

Similar Messages

  • Getting selected item from combobox itemrenderer and storing in object

    Hi Guys,
    Can anyone help me in this regard. Its very urgent.
    I have a combo box itemrenderer in datagrid column. I want to get the user selected item from the dropdown of the row(s) (User may select values from combo box from multiple rows of datagrid) and corressponding values of all other columns of the rows and store it in an object . Then pass this object to database to update only those rows that user has changed.
    I am able to get the selected item from combo box using "event.currentTarget.selectedItem" and corressponding values of all other columns of the rows using "valueSelect.ID", etc where valueSelect is object which contains data for datagrid. But am stuck up with, how to store the selected item value of the combobox  and corressponding values of all other columns of the rows into an Object ?.
    Can anybody help me with sample to store selected item from combobox and its corressponding values of all other columns into an object which i can send to db...?
    Kindly help me in this regard.
    Thanks,
    Anand.

    Hi!
    Are you using a collection of VO or DTO as the dataprovider of the combobox component?
    If so, have you created some attribute there to control the user's selection in the combobox?
    For instance:
    private var selected:Boolean = false;
    If your solution fits this approach, you may create a new collection that contains just the objects that were selected by the user, it means you can loop through the datagrid's dataprovider and only insert in this new collection those objects that have the attribute "selected" set to true.
    For instance:
    private function getSelectedRecords(datagridDataProvider:ArrayCollection):ArrayCollection
        var newCollection:ArrayCollection = new ArrayCollection();
        for each (var item:Object in datagridDataProvider)
            if (item.selected)
                newCollection.addItem(item)
        return newCollection;
    Afterwards, you may serialize this new collection with your back-end.
    Hope it helps you!
    Cheers,
    @Pablo_Souza

  • Dynamic comboBox in a dataGrid?

    i have a dataGrid that starts out blank. When a button is
    clicked, it populates based on the contents of a few components.
    The 3rd column needs a comboBox. I need the following
    behaviors:
    1-when the button is clicked, this populates with the text
    values in a certain text field.
    2-under certain circumstances, i need to be able to add and
    subtract from this comboBox.
    i have read this:
    http://blog.flexmonkeypatches.com/2008/02/18/simple-datagrid-combobox-as-item-editor-examp le/
    but it looks like the comboBox in that example has fixed
    values. How can i dynamically alter the values in
    these comboBoxes? i have the comboBoxes in the dataGrid
    component, but i can't figure out how to access their
    dataProviders!
    thanks!

    You can have your comboBox itemRenderer populate based on an
    ArrayCollection in your dataDrid dataProvider. Then, by changing
    the dataProvider's ArrayCollection field, you could change each of
    the comboBoxes accordingly. If you need different comboBox values
    for different comboBoxes, then you will need something a bit
    different. It would help to see your code.
    Vygo

  • ComboBox inside a datagrid

    Hi all,
    How can I put a comboBox inside a datagrid?
    I want to set the comboBox with their own dataprovider and
    the id should
    pass to the datagrid fill at the save time.
    I try this but doesnt let me to include a dataprovider.
    Any links??
    please help and thank you in advance.
    JFB
    <mx:DataGridColumn headerText="Rate" dataField="rate"
    editable="false">
    <mx:itemRenderer>
    <mx:Component>
    <mx:VBox>
    <mx:ComboBox id="rate_cb"></mx:ComboBox>
    </mx:VBox>
    </mx:Component>
    </mx:itemRenderer>
    </mx:DataGridColumn>

    Hi,
    I think you need to declared your array public at the
    begining of the page
    like
    [Bindable]
    public var dataArray = new ArrayCollection();
    You need to use outerDocument.
    <mx:ComboBox activate="true" labelField="TEXT"
    dataProvider="{outerDocument.dataArray}" />
    I discover that the components are case sensitive also.
    I hope this help.
    JFB
    "MLK_SS" <[email protected]> wrote in
    message
    news:[email protected]...
    > Hi All,
    >
    > I am having a problem displaying data into a combo box
    inside a data grid.
    >
    > I am getting data from a webservice and storing the data
    into a Array
    > Collection variable and trying to pass the var as the
    data provider for
    > the
    > combo box.
    >
    > If I try an individual combo box it works fine.
    >
    > But, when trying to integrate into a datagrid it gives
    an error saying
    > Access
    > of undefined property. I tried using outerDocument as
    mentioned above, the
    > error doesnot show up but the output does not show up
    with the data inside
    > the
    > Data grid Combo box.
    >
    > <mx:DataGrid id="fav" x="10" y="332"
    headerColors="[#C3D3AA, #C3D3AA]"
    > enabled="true" editable="true"
    textDecoration="underline">
    > <mx:columns>
    > <mx:DataGridColumn width="120" headerWordWrap="true"
    > headerText="Fav./Del./ Copy/Edit" fontWeight="bold"
    editable="false"
    > dataTipField="Favourites" activate="true" >
    > <mx:itemRenderer>
    > <mx:Component>
    > <mx:VBox>
    > <mx:ComboBox activate="true" labelField="TEXT"
    > dataProvider="{dataArray}" />
    >
    > </mx:VBox>
    >
    > </mx:Component>
    > </mx:itemRenderer>
    > </mx:DataGridColumn>
    > </mx:columns>
    > </mx:DataGrid>
    >
    > the function that handles the data result is :
    >
    > public function handleResult(event:ResultEvent):void{
    >
    > dataArray = new ArrayCollection();
    >
    > tasktypeArray = new ArrayCollection();
    > var myXML:XML = new XML(event.result);
    > var kf:XMLList = myXML.child("WORKLIST");
    >
    > var tasktype:XMLList = myXML.child("TASKTYPE");
    > a = kf.item;
    > b= kf.item[0].TEXT;
    >
    > textarea1.text = myXML.toXMLString();
    > textarea3.text = myXML.child("TEMPLATE");
    > trace(kf.child("TEXT").length());
    > for (var x:int = 0; x < 25; x++) {
    > var resultObj:Object = new Object ();
    >
    > resultObj.TEXT
    > =tasktype.descendants("item")[x].TEXT.valueOf();
    > dataArray.addItem(resultObj);
    >
    > }
    >
    > Please let me know where I am going wrong
    >
    > Thanks,
    >
    >

  • What is a Database-Driven Websites?

    the term Database-Driven Websites?
    what is it?
    and how does this work?
    thanks

    > the term Database-Driven Websites?
    > what is it?
    > and how does this work?
    well the data is stored in a database and based on the user's
    selection(s), the data is served.
    Think of a shopping cart. You click that you want to see info
    about shirts, the result is that the database serves up a
    list of
    shirts. Next, you select long-sleeved and the database serves
    up a list of long-sleeved shirts which may include pictures
    and
    other information.

  • ComboBox embedded in DataGrid

    Hi,
    I want to embedded a ComboBox in a Datagrid.
    The data displays in the Combox with the code in the
    ComboBoxCellRenderer.as:
    public function set data(value:Object):void {
    _data = value;
    var dp:DataProvider = new DataProvider(value.plaats);
    dataProvider = dp;
    public function get data():Object {
    _data.plaats = arr;
    return _data;
    -How can I transmit the ComboBox.selectedItem to the Datagrid
    -and how can I read the CellRenderer.data in the DataGrid,
    var cr: ComboBoxCellRenderer =
    Datagrid.itemToCellRenderer(e.item) as ComboBoxCellRenderer
    =>returns null
    trace(cr.data);
    Thanks for helping me

    Hi,
    I'm sorry to bug you with a non-technical discussion, but I
    am a recruiter in San Diego. My client is in need of 3 Senior Flex
    Developers for their project. I have had an extremely rough time
    finding someone for this position. Would you be interested in this
    position, or do you know of anyone that might be? We do pay
    referral fees. This position may be open to telecommuting.
    Job Description:
    They are in the midst of a major re-architecting of their
    Corporate Management system utilizing many cutting edge
    technologies. As it relates to the position they are using Flex as
    their UI.
    This is either a contract, or a full-time position.
    Pay: Market Rate
    Thanks for your help!
    Natalie Fay
    Outsource Technical
    www.ostechnical.com
    [email protected]
    858.874.5637

  • JavaFX for database driven applications? No Tree or Table components?

    Hi there,
    Most of the apps I do are database driven and require liberal use of tables and tree components. I see these are missing from JavaFX.
    So the questions I have are:
    Will they be introduced later?
    How does one create custom components for JavaFX?
    Are there any 3rd party components that offer this yet?
    thanks

    You can find an example of the Table component creation and usage on page:
    [http://jfx.wikia.com/wiki/SwingComponents|http://jfx.wikia.com/wiki/SwingComponents]

  • Use dropdownlist to select image (database driven)

    Im building a web application in flash builder which will be database driven. The database will contain id (of product), name (of product), photofile (text string i.e photo1.jpg). i have the data/services up and running, i just need to get it so when the user selects a name from the dropdownlist the corresponding photofile is selected into the picture frame.
    I know to turn the photofile text into a picture it will be something like this but not sure what code to insert into the <s:Image tag;
    private function getPhotoURL(item:Object):String{
                                    return "http://............./assets/"+item.photofile;
    I don't know how to bind everything together, any help would be appreciated.

    I have 2 programs:
    First Pgm:
    <?php require_once('Connections/abc.php'); ?>
    <?php
    mysql_select_db($database_abc, $abc);
    $query_Recordset1 = "SELECT * FROM replyarticle";
    $Recordset1 = mysql_query($query_Recordset1, $abb) or
    die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <a href="thumb.php?id=<?php echo
    $row_Recordset1['postid'];?>"><img src= "idea.GIF"
    width="20" height="19" border="0" /></a></p>
    </body>
    </html>
    <?php
    mysql_free_result($Recordset1);
    ?>
    Second pgm: thumb.php
    <?php require_once('Connections/abc.php'); ?>
    <?php
    $colname_Recordset1 = "-1";
    if (isset($_GET['id'])) {
    $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['id']
    : addslashes($_GET['id']);
    mysql_select_db($database_abc, $abc);
    $query_Recordset1 = sprintf("SELECT * FROM replyarticle WHERE
    postid = %s", $colname_Recordset1);
    $Recordset1 = mysql_query($query_Recordset1, $abb) or
    die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=" />
    <title>Untitled Document</title>
    </head>
    <body>
    <?php
    $img= $row_Recordset1['book_no']; ?>
    <?php
    $img_name=$img;
    header("Content-type: image/jpeg");
    list($w,$h)=getimagesize($img_name);
    $src_img=imagecreatefromjpeg($img_name);
    imagejpeg($src_img);
    imagedestroy($src_img);
    mysql_free_result($Recordset1);
    ?>
    </body>
    </html>
    Micha, am I working on what you said?

  • Howto build database driven forms

    Hello
    I'm a newbie to oracle forms.I'm intrested in creating a database driven form which would take single or multiple input from user in single or multiple input boxes and add in a table which i shall query to develop oracle reports.I should also be able to populate data from the table onto the forms for users to review.
    Kindly guide.I'm also googling for a suitable oracle forms guide too.If you have any do let me know.
    Regards
    Fahad

    Fahad,
    You're already in the right place to find documentation on Oracle Forms (see link [Oracle Developer Suite 10g Release 2 (10.1.2) Documentation|http://download.oracle.com/docs/cd/B25016_08//doc/dl/index.htm] ). Here are a few other books available that can get you started as well:
    [Learning Oracle Forms 4.5: a Tutorial for Forms Designers|http://www.amazon.com/Learning-Oracle-Forms-4-5-Designers/dp/0964723301] - Yes, it is for Forms 4.5, but the concepts still apply.
    [Oracle Forms Interactive Workbook|http://www.pearsonhighered.com/academic/product/0,3110,0130158089,00.html]
    [Oracle Developer Advanced Forms and Reports|http://www.amazon.com/Oracle-Developer-Advanced-Forms-Reports/dp/0072120487]
    [Oracle Forms Developer -- The Complete Video Course|http://www.amazon.com/Oracle-Forms-Developer-Complete-Course/dp/0130321249/ref=pd_sim_b_1]
    Hope this helps.
    Craig...
    -- If my response or the response of another is helpful or answers your question, please mark the response accordingly. Thanks!
    Edited by: CraigB on Sep 29, 2008 10:05 AM

  • LOVs and how to substitute a database driven value with a more readable val

    Hello,
    I am using LOVS in my view objects and I like it because it is saving me time whille developing my UI: I get drop down list made automatically for me in my UI forms.
    However I have a requirement to change the values we see in the drop down today.
    Basically the values that show in the drop down are database driven and they are not very readable for the end users, so I would like to somehow convert them with some values that I know would make more sense.
    Let say in my database I have a fiield name type that can be G for general or S for Specific, I would like the user to see General or Specific in the drop down list instead of G or S. How would you do that and can LOVs be configured to do that?
    Thanks

    there is something called display attribute when you create your lov in the ui hints tab..
    you have shuttle the description for the code to the selected pane. .so that you see the description instead of the code that is bounded for the lov attribute..
    http://blogs.oracle.com/workingwithadf/entry/adf-bc_creating_a_listofvalues_lov_and_a_cascaded_lov
    https://lh6.googleusercontent.com/-LZExUnvVJAo/TXNp71j7VII/AAAAAAAAE3s/1ukcrJOrw2Y/s1600/4.png

  • Retrieving Data from database to combobox

    Hi
    Can anyone help in retrieving data from database to combobox..
    All the names of employees and their designations are stored in database.so i want retrieve them in other page.
    both designation and names of employees are comboboxes.
    after loading tha page i need to get all the designations which are stored in database in first combobox and when i select a particular designation i need get all tha names of employees of that designation in other combobox.this has to be done using jsp and ajax.
    please can anyone give me the code for this using Ajax and Jsp.

    Hello Friend try this code
    dbdata.jsp
    <%@page language="java" import="java.sql.*"%>
    <html>
    <%
    Class.forName("..........");
    Connection n=DriverManager.getConnection ("....","...","...");
    Statement st=con.createStatement();
    ResultSet rs=st.executeQuery("select ename from emp");
    %>
    <body>
    <form>
    <select>
    <%
    while(rs.next())
    %>
    <option><%=rs.getString("ename")%></option>
    <%
    %>
    </select>
    </form>
    </body>
    </html>

  • DATABASE DRIVEN WEBSITE

    Hello folks,
    I want to create a website , not super classy but simple one . I want to have the website connected to a oracle database where all the details of products will be stored. Not much into details just enough. Then connect the website with the database so that we can add,delete,update things from the website . Website be a front end and oracle database a back end.
    This is for my project . I have created static web pages with pagebreeze. I have downloaded the oracle 10g thing on my system. I think i can create a database in that . But now how to link both things and how to go from here to get a database driven website ?
    Please help me i am stuck.

    I created some simple web pages to display/update details on an oracle database. I used apache web server, and php for the pages. In php it is simple to access an oracle database using oci_connect, oci_parse, oci_execute, etc.

  • Can anyone help with database driven design

    Hi,
    I would like to determine the best way to serve large amounts
    of text on an html page. I have manuals with lots of links that I
    want to add to a website. I would like to employ database driven
    web development in my design, would this be a good use for it? If
    so would you suggest php and what database?
    Thanks!
    Please forgive me for double posting, I posted this in the
    general forum but maybe should have done it here first?

    I would say it totally depends on the format that the manuals
    are in. If they're HTML than you can store them as BLOB's in mysql
    and you're life will be rather easy. You would need to parse the
    blob output for URLs but that's about it.
    However, if the manuals are in PDF than a database wouldn't
    help with the storage of the actual files, however you can use
    either XML or a DB (i.e. mysql) to store the metadata about that
    manual so that you can at least make the site searchable.
    A little more information about your data/website would
    probably be helpful.
    Aram

  • Can Adobe Muse be used to create database driven websites?

    Can Adobe Muse be used to create database driven websites, or is it only through "replace image through browse from your computer".

    Hi Edgard,
    I am afraid that this is not possible in Muse at this stage, I will recommend that you post this on our ideas section over here, Ideas for features in Adobe Muse, and let our devs team know of this requirement.
    In muse you can only design static content. For any dynamic content that you need to render via DB, you will need to write custom code and insert it in Muse via 'object -> insert html' option or 'properties -> metadata -> html for head' option.
    - Abhishek Maurya

  • Safari hangs when posting forms on php database driven sites

    Hello,
    I build php MySQL database driven sites all day long, and over the last year i have noticed that when using safari and "Only Safari"... If i post a form which submits data to the database the page hangs for about a minute and then ends up on a blank page. (the data was successfully submitted to database though)
    This does not happen for any other browser, only safari. It happnes on at least 10 sites i have built. i thought it was an quirky issue with my computer, but now it is happening to a client.
    also this, doesnt happen to any ASP sites I build, only safari and php/mysql
    My safari is 2.0.4

    Hi,
    From your Safari menu bar click Safari / Preferences then select the Extensions tab. If you have any installed, then turn off, restart Safari. Try a site that uses web based forms.
    If it's not Extensions causing this, from the menu bar again, click Safari / Preferences - Autofill.
    Click the Edit button next to *Other forms*
    Click: Remove All then click Done.
    Restart Safari. Try again. If that didn't help, back to the menu bar, click Safari / Reset Safari. Select the top 7 buttons, click Reset. Restart Safari. Try again...
    Carolyn

Maybe you are looking for

  • Lost music on i pod

    All my music is on i tunes but not on my i pod keep getting the message 'songs on the ipod cannot be updated because all of the playlists selected for syncing no longer exist' I am set to automatically update specif play lists only.

  • Filter Pivot table data based on custom calculated item in obiee 11g

    Hi, I have requirement as below. Please provide your valuable suggestions Please note that "Diff" is the calculated item using the formula "$2-$1" Pivot table View: Sales ID 20120207 20120220 Diff 1 0 0 0 2 100 0 -100 3 100 200 100 4 100 100 0 5 200

  • Survey In Win client

    Does anybody know how to make survey work in winclient using survey suite.  I want to conduct a survey after an activity. thanks eleanor

  • Maximum MAC address table size

    Hello guys. what is the maximum MAC address table for the Cisco 3750X series switches?

  • Ask the Experts Session on Java Plug-In Technology (Feb 12-16)

    Java Plug-in technology, included as part of the Java Runtime Environment, Standard Edition (Java SE), establishes a connection between popular browsers and the Java platform. This connection enables applets on Web sites to be run within a browser on