Changing dataprovider in a combobox

I'm trying to write an app which uses two combo boxes. If the
first combo box is changed, the second combo box should be filled
with a differnt set of values. I'm trying to do this by building
several arrays which will correspond to a n entry in the first
combo box. If one of these entries is selected, I simply want to
change the dataprovider field of the second combo box. Changing the
first combobox works, but instead of loading the array, it just
puts one entry in which is the name of the array. Here is the code
I'm using:

Your syntax when reassigning the DPs is wrong. Should be:
comboField.dataProvider=custsAC;
comboField.dataProvider=apsAC;
etc.
TS

Similar Messages

  • Flex 3 : XML File as DataProvider to a Combobox

    Hi,
    I am uisng Flex 3 for our Application Front End
    I am having an External XML file as shown
    <states>
                <state>Andhra<state>
        <state>Telangana<state>
                <state>Rayalseema<state>
        <state>Maharatsthra<state>
    </states>
    and with lots of data ---etc
    I  am having a Combobox , how can use this Above XML file as Dataprovider to my Combobox
    please sugest , thanks .

    Thanks
    jfb00  , i will try and let know if i face issues .

  • Dynamic dataprovider in Datagrid combobox.

    Hi,
    i am using Flex 3. I have a data grid with first two rows having item renderers as ComboBoxes. What i want to implement is that, depending on my selection in the first combobox, the respective second combobox should get a dataprovider of my choice.
    For e.g.
    If I select the 1st combobox as India, then the adjacent combobox should have the cities in India.
    If I select the 1st combobox as France, then the adjacent combobox should have the cities in France.
    I dont have the values in any local variables. The values must be fetched at runtime because the list of Countries(in first combobox) is very exaustive so fetching the list of all cities for all countries would not be right. So for each selection of country i have to make an http service call to fetch the corresponding city list.
    My question is how do i dynamically give the cities as dataprovider to each of the combo boxes in each row.
    Hope my description is comprehensible enough.
    Thanks
    Sid.

    HI,
    Can you check the below code. If that is what you need.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                     layout="vertical"
                     creationComplete="application1_initializeHandler(event)">
         <mx:Script>
             <![CDATA[
                 import mx.collections.ArrayCollection;
                 import mx.events.FlexEvent;
                 // Defines your collections
                 [Bindable]
                 public var countriesData:ArrayCollection=new ArrayCollection([{label: 'India'}, {label: 'Brazil'}]);
                 [Bindable]
                 public var citiesData:ArrayCollection;
                 [Bindable]
                 public var collection:ArrayCollection=new ArrayCollection();
                 protected function application1_initializeHandler(event:FlexEvent):void
                     dataGrid.addEventListener("countryChanged", country_changed_handler);
                     collection.addItem({cityData:citiesData});
                // Change this method to the remote callings.
                // In the resultEvent you will change the citiesData collection.
                 protected function country_changed_handler(event:DataEvent):void
                     if (event.data == 'India')
                         dataGrid.selectedItem.cityData = new ArrayCollection([{label: 'Mumbai'}, {label: 'Delhi'}]);
                     else
                         dataGrid.selectedItem.cityData = new ArrayCollection([{label: 'São Paulo'}, {label: 'Rio de Janeiro'}]);
                     dataGrid.invalidateList();
                 public function addRow(event:MouseEvent):void{
                     //collection.addItem(new Object());
                     collection.addItem({cityData:citiesData});
                 public function dropRow(event:MouseEvent):void{
             ]]>
         </mx:Script>
         <mx:DataGrid id="dataGrid"
                      dataProvider="{collection}">
             <mx:columns>
                 <mx:DataGridColumn>
                     <mx:itemRenderer>
                         <mx:Component>
                             <mx:ComboBox dataProvider="{this.parentDocument.countriesData}"
                                          labelField="label"
                                          change="combobox1_changeHandler(event)"
                                          selectedIndex="-1">
                                 <mx:Script>
                                     <![CDATA[
                                         import mx.collections.ArrayCollection;
                                         import mx.events.ListEvent;
                                        protected function combobox1_changeHandler(event:ListEvent):void
                                             dispatchEvent(new DataEvent("countryChanged", true, true, this.selectedLabel));
                                     ]]>
                                 </mx:Script>
                             </mx:ComboBox>
                         </mx:Component>
                     </mx:itemRenderer>
                 </mx:DataGridColumn>
                 <mx:DataGridColumn>
                     <mx:itemRenderer>
                         <mx:Component>
                             <mx:ComboBox labelField="label">
                                 <mx:Script>
                                     <![CDATA[
                                              override public function set data(value:Object):void
                                                super.data = value;
                                                var prevSelectedItem:Object = this.selectedItem;
                                                this.dataProvider = data.cityData ;
                                                this.selectedItem = prevSelectedItem;
                                     ]]>
                                 </mx:Script>
                             </mx:ComboBox>
                         </mx:Component>
                     </mx:itemRenderer>
                 </mx:DataGridColumn>
             </mx:columns>
         </mx:DataGrid>
         <mx:HBox width="299" horizontalAlign="center" horizontalGap="51">
             <mx:Button label="Add" click="addRow(event)"/>
             <mx:Button label="Drop" click="dropRow(event)"/>
         </mx:HBox>
    </mx:Application>

  • Change selected option in ComboBox as the user types

    Is there a way to make the selected item in a ComboBox change
    as the user types? Something like an autocomplete. The default
    functionality seems to be that it will move to the next option in
    the list that starts with the letter you type...but I'd like to be
    able to type something like a last name and have it select that
    option.

    There is an autocomplete component on Flex Exchange. I don't
    have the url handy but google will find it.
    Tracy

  • Problem in changing dataprovider

    Hi,
    I have a Datagrid which contains List as Itemrenderer.I am providing data to the list through arraycollection.I need to change the dataprovider while clicking the button.I have two arraycollections a2 and a3.
                        var ac2:ArrayCollection = new ArrayCollection([ { TaskName: "A" }, { TaskName: "B" }, { TaskName: "C" } ]);
                        var ac3:ArrayCollection = new ArrayCollection([{TaskName: "D"},{TaskName: "E"},{TaskName: "F"}]); 
    At first the datagrid displays A B C.When i clicked the change button to change the dataprovider its displaying D A B insted of D E F
    The complete code is given below.Any one pls help me to solve tis problem.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
        <mx:Canvas id="can3" width="366"    height="286" label="Project Management Related Tasks">
                <mx:Script>
                             <![CDATA[
                            import mx.collections.ArrayCollection;
                            import mx.events.CollectionEvent;
                            import mx.controls.Alert;
                            function changeDataprovider()
                                dg.dataProvider=ac3;
                            function dataProvider():void
                                dg.dataProvider=ac2;
                        var ac2:ArrayCollection = new ArrayCollection([ { TaskName: "A" }, { TaskName: "B" }, { TaskName: "C" } ]);
                        var ac3:ArrayCollection = new ArrayCollection([{TaskName: "D"},{TaskName: "E"},{TaskName: "F"}]);   
                        ]]>         
                         </mx:Script>
                <mx:DataGrid sortableColumns="true" id="dg" creationComplete="{ dataProvider();}"   alpha="2" resizableColumns="false"   width="100%" borderThickness="0" color="black" height="266" >
                    <mx:columns>
                        <mx:DataGridColumn color="navy"  headerText="Task Name" dataField="TaskName" fontWeight="normal">
                         <mx:itemRenderer>
                 <mx:Component>
                     <mx:HBox>
                     <mx:List  id="ManagementList" dragEnabled="true" creationComplete="data1()"   themeColor="white"  allowMultipleSelection="false"   width="85"         height="20" rowHeight="20" borderThickness="0" />
                           <mx:Script>
                             <![CDATA[
                            function data1():void
                                ManagementList.dataProvider = data.TaskName;
                             ]]>         
                         </mx:Script>
                       </mx:HBox>
                      </mx:Component>
                 </mx:itemRenderer>
                 </mx:DataGridColumn>
                 </mx:columns>
                     </mx:DataGrid>
                    </mx:Canvas>
                    <mx:Button id="but" label="change" click="changeDataprovider()" />
    </mx:Application>

    If you remove this code snippet your app will work fine.
    <mx:itemRenderer>
                 <mx:Component>
                     <mx:HBox>
    <mx:List  id="ManagementList" dragEnabled="true"
    creationComplete="data1()"   themeColor="white"
    allowMultipleSelection="false"   width="85"         height="20"
    rowHeight="20" borderThickness="0" />
                           <mx:Script>
                             <![CDATA[
                            function data1():void
                                ManagementList.dataProvider = data.TaskName;
                             ]]>         
                         </mx:Script>
                       </mx:HBox>
                      </mx:Component>
                 </mx:itemRenderer>
    I see you want to add an itemRenderer but I don't get why you need an script there, or what you need to accomplish.

  • Changing dataProvider of custom dataGrid to XCelsius Cells

    Hi everybody,
    I have quite a simple question, however, I do not really get a solution for that on my own.
    Actually, all I want to do is extend a usual Datagrid to display my data from XCelsius using the standard propertysheet. The way I tried to do this was to make the dataProvider inspectable.
    My actionscript file:
    package myPackage
         import mx.controls.DataGrid;
         [CxInspectableList("dataProvider")]
         public class MyDG extends DataGrid
              public function MyDG()
                   super();
              [Inspectable(defaultValue="undefined", type="Array2D")]
            [ArrayElementType("Number")]
              override public function get dataProvider():Object
                   return super.dataProvider;
              override public function set dataProvider(value:Object):void
                   super.dataProvider(value);
    When I pack this into an .xlx, I can view it and preview it as long as I do not try to change the dataProvider. When changing it, the preview window stops to load at some point.
    Thanks for your help in advance!

    Hi Sreelekha,
    This is how Flex creates 2d arrays so Xcelsius does the same when it passes a 2d array.
    var cells:Array =
       /* row 1 */   [ column 1, column 2, column 3],
       /* row 2 */   [ column 1, column 2, column 3],
       /* row 3 */   [ column 1, column 2, column 3]
    So in your case:
    var cells:Array =
        [P1, C1],
        [P2, C2]
    So cells.length tells you how many rows are in the 2d array.
    And cells[0].length tells you how many columns are in the first row of the array (assuming there is at least one row).
    So as in Flex if you want to process a Flex 2d array you do something like this:
    for (var i:int = 0; i < cells.length; i++)
        var row:Array = cells<i> as Array;
        for (var j:int = 0; j < row.length; j++)
           var rowColCell:* = row[j];
           // rowColCell has the value for this row/column cell.
    Regards
    Matt

  • Change dataprovider on webi report - SDK

    Hello, in a nutshell, is it possible to change the dataprovider of a webi report through the .NET sdk? I have read on the forum it is only possible with the JAVA SDK? I can readout all information of the webi report datasource/dataprovider, but it is readonly.
    Can somebody confirm or better tell me how to it with the .net sdk
    Regards Ingmar - bilifecycle.com

    Very good comments! I have some additional info >>
    Web Intelligence wid files references Universes in two ways - by the Universe CUID value (SI_CUID when you query for the Universe InfoObject), or by the Universe short name (SI_SHORTNAME).
    Ok
    The SI_ID of an Universe changes, but migrating a Universe (not just redeploying to a different Enterprise deployment) keeps the SI_CUID value the same.
    Ok
    If a Universe with the SI_CUID value is not available on the system, the it picks a Universe with the same SI_SHORTNAME.
    Ok, perfect. Tha't solves my problem! In practice, an user sould only be able to access 1 universe at a time avoiding conflicts. Like ZABO in BO 6 couldn't handle access to e.g. acceptance and production universe at a time. It would give an error. The fullclient however gives you at least the option to choose...
    You can determine if the Universe is being referenced by CUID or Shortname by querying for the Universe in Query Builder, and seeing if the SI_UNIVERSES property is filled. If that property is empty, then the Shortname is being used. Referencing Universes by shortname is dangerous, since you won't know which Universe is being used.
    Like explained above, we always make sure an user has only access to 1 version of an universe and report. Please let me know your thoughs if you have doubts or comments about this construction!
    Sincerely,
    Ted Ueda
    Thank you for explaining how the process works! Regards Ingmar

  • Where to put the code for dynamically change  dataprovider

    I have a table bound to dataprovider1 by default ( by the SJC ). In the same page, I also have a dataprovider2 which is for the same fields of the same table of dataprovider1. The only different is to put some criteria on one field ( like F_D1 = '5' ) so that one provider will show all rows, the other just some rows.
    The code to change the dataprovider is as follows :
    tableRowGroupWorksheet.setValueBinding("sourceData", getApplication().createValueBinding("#{WorksheetPage.dataprovider2}") );
    If I put this code into some button_action() and then I click that button, then the page displays the corresponding data just fine.
    But if I put this code in either preprocess or prerender, then things seems messed up : the number of pages is for data of dataprovider1, but when I click button Next of the table then it shows the number of pages of dataprovider2. ( I also try to put it in init but this does not help either ).
    I need this code to be run when this page is selected but right now it requires me to click on a button :(
    The reason I need it runs automatically is because of the logic generated from the previous page.
    Thanks for your advive,
    Vu

    After re-reading the life-cycles of JSF and the injected phases of SJC, I think I know why it does not work when the page is first called. In this case, AplyRequestValue phase is skipped therefore preprocess is never called. Also in this case, the component tree, with binding, validators, ... is only built in the Render Response phase and this phase is right after PreRender is called therefore the binding code I put in prerender is overwritten by Render Response.
    When using a button action, the component tree is already built and not rebuit under Render Response, therefore that code is not overwritten. Also in this case, preprocess is called so putting that code under either preprocess or prerender will work.
    Please correct me.
    Thanks,
    Vu

  • Changing prompt position in combobox?

    Hi
    I  change the height of my comboBox to fit with what I need.
    Now the text in the prompt is sitting too low.
    I was wondering if it's possible to alter the y attribute of the prompt, and where in the component you would find it?
    Thanks
    Shaun

    Yes,
    Actually, I have to display a '1' or a '0' in one of my report depending on the difference between requested quantity and ordered quantity. I created a calculated ratio :
    ( req_qty-ord_qty == 0 ) * 1
    That works fine at a detailled level (request doc number).
    When I display on agregated levels, it doesn't sum the '1', but it does the difference between the sum of req_qty and the sum of ord_qty.
    So I tried to calculate it during the transformation. That works for Doc Number with one Item.
    I don't want the Item dimension in my infocube. Hence I want to sum the req_qty and ord_qty of the different items of a doc number before testing my condition.
    Here is the code:
    LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
      AT NEW DOC_NUM.
         CLEAR v_diff.
      ENDAT.
    v_diff = v_diff + <RESULT_FIELDS>-/BIC/RQTEDHA - <RESULT_FIELDS>-PO_QTY.
    AT END OF DOC_NUM.
       IF v_diff EQ 0.
       <RESULT_FIELDS>-/BIC/ZCOMPTEUR = 1.
       ENDIF.
    ENDAT.
    ENDLOOP.

  • Changing dataprovider to call itemrenderer

    I have list with itemrenderer function. In list I have creation complete event in which I set my dataprovider like:
    [Bindable] var myArrayCollection:ArrayCollection;
    private function creationComplete(event:FlexEvent):void
         //code
         myList.dataProvider = myArrayCollection;
         //code
    and then when I add some item to my myArrayCollection in some other class, shouldn't dataProvider get changed and automatically call itemrenderer?
    because at the moment when I use myArrayCollection.addItem(someItem); in different class, item renderer doesn't get called...
    In my understanding it should get called, because I set myArrayCollection as bindable. Should it be like I discribed above?
    or I got the whole picture totally wrong.

    If there are enough renderers on the free list, then it won’t create a new one, and if you are using virtualLayout, a renderer will not get created unless the new item is viewable.

  • Date Changes by itself in ComboBox

    Hi Gurus,
    I am opening this thread in continuation to my previous thread:-
    Date range in Xcelsius
    I could resolve this issue by referencing the cells in the next column in descending order for eg. I had data in ascending order  in M3 to M38 so  what I did was in N3 to N38 i referenced as follows In N3 I referenced M38, in N4 I referenced M37, In N5  M36 is referenced..Like that. And referenced all the combo boxes to N3:N38. And it helped me to get the desired results. However, I am facing a very strange problem.
    In the Dashboard comboBox, if we select 08/2010, after 10 seconds it goes back to 7/2008. I have checked all the propertied and did not find anything which could cause this problem.
    Anyone has any idea why its happening?
    Regards

    resolved

  • Changing animated images via combobox

    Hi,
    Any help is greatly appreciated with this problem: I have an applet that allows a small moveable image to be manipulated within a larger one. It works fine when I hard code the image filenames but I cannot get it to work when I use a combobox to allow choices of the two image files. Here is the code:
    package elaine;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.net.URL;
    * <p>Title: Wavelength Filter Viewer</p>
    * <p>Description: View the image through a filter</p>
    * <p>Copyright: Copyright (c) 2002</p>
    * <p>Company: Elaine</p>
    * @author unascribed
    * @version 1.0
    public class AppletElaine extends JApplet implements MouseMotionListener{
    private Container c = getContentPane();
    private BorderLayout layout;
    private JPanel cboxPanel;
    private JPanel viewPanel;
    private JViewport vp = null;
    private RasterComponent rc = null;
    private RasterComponent rc2 = null;
    String var1, var2;
    private JButton circle;
    private JComboBox imagesOne;
    private JComboBox imagesTwo;
    private String names[] =
    { "seit_171.jpg", "seit_195.jpg", "seit_284.jpg", "seit_304.jpg",
    "smdi.jpg", "norh_17ghz.jpg", "nancay_183cm.gif"};
    Image img1 = null;
    Image img2 = null;
    private boolean inAnApplet = true;
    URL codeBase; //used for applet version only
    boolean isStandalone = false;
    //Construct the applet
    public AppletElaine() {
    //Initialize the applet
    public void init() {
    layout = new BorderLayout( 5,5 );
    c.setLayout( layout );
    cboxPanel = new JPanel();
    viewPanel = new JPanel();
    imagesOne = new JComboBox(names);
    imagesTwo = new JComboBox(names);
    cboxPanel.setLayout( new GridLayout( 1, 2 ) );
    cboxPanel.add( imagesOne );
    cboxPanel.add( imagesTwo );
    imagesOne.addItemListener( new ItemListener() {
    public void itemStateChanged( ItemEvent e )
    loadImages( names[ imagesOne.getSelectedIndex() ],
                        names[ imagesTwo.getSelectedIndex() ] );
    imagesTwo.addItemListener( new ItemListener() {
    public void itemStateChanged( ItemEvent e )
    loadImages( names[ imagesOne.getSelectedIndex() ],
                        names[ imagesTwo.getSelectedIndex() ] );
    c.add( viewPanel, BorderLayout.CENTER );
    c.add( cboxPanel, BorderLayout.NORTH);
         setSize(400,420);
    show();
    public void loadImages( String var1, String var2 ) {
         try
         img1 = getImage( new URL( getCodeBase(), var1 ) );
         img2 = getImage( new URL( getCodeBase(), var2 ) );
         catch( Exception e )
         e.printStackTrace();
         rc = new RasterComponent( img1 );
         rc.setBounds( 0, 0, rc.getPreferredSize().width,
              rc.getPreferredSize().height );
         rc.addMouseMotionListener( this );
         vp = new JViewport();
         rc2 = new RasterComponent( img2 );
         vp.setView( rc2 );
         vp.setBounds( 0, 300, 100, 100 );
         viewPanel.add( vp );
         viewPanel.add( rc );
    public void mouseMoved( MouseEvent e )
         int x = e.getX() - vp.getExtentSize().width / 2;
         int y = e.getY() - vp.getExtentSize().height / 2;
         vp.setViewPosition( new Point( x, y ) );
         vp.setBounds( x, y, 100, 100 );
    public void mouseDragged( MouseEvent e )
    private class RasterComponent extends JComponent
         private Image image = null;
         private Dimension size = null;
         public RasterComponent( Image img )
         image = img;
         loadImage();
         public Dimension getPreferredSize()
         return size;
         public void paint( Graphics g )
         g.drawImage( image, 0, 0, size.width,
                   size.height, this );
         protected void loadImage()
         MediaTracker tracker = new MediaTracker( this );
         tracker.addImage( image, 1 );
         try
              tracker.waitForAll();
         catch( InterruptedException e ){}
         if ( size == null )
              size = new Dimension( image.getWidth( this ),
                             image.getHeight( this ) );
         setSize( size );
    That's it. Thanks!

    try this way:
    public void loadImages( String var1, String var2 ) {
    try
    img1 =
    (new ImageIcon(getClass().getClassLoader().getResource(var1))).getImage();
    catch( Exception e )
    e.printStackTrace();
    //...

  • Change datagrid query from combobox

    So I have a datagrid with a couple combo boxes down at the bottom. The combo boxes have static values. Based on the selection, I want the combo box to invoke the query in my CFC, passing the argument of what the selected value is. Then have the datagrid refresh with the new query.
    Anyone passed by any tutorials for this type of thing?
    I have seen some where you dump all the data to the grid and filter based on the combobox, but I would prefer to not have all of that overhead of pulling every record. I would like for the SQL to do the filtering based on the argument.
    Thanks!

    Are the comboboxes in the datagrid/itemrenderer or are they at the bottom of the container ?

  • How to change 'dataprovider' using 'states'

    Hi All
    I have 2 arrays and a HorizontalList. I want to be able to switch between the arrays using states. The states and horizontal list look like
    <mx:Array id="arr1">
    </mx:Array>
    <mx:states>
       <mx:State name="state1">
          <mx:SetProperty name="dataprovider" target="{horizontalList}">
             <mx:value>
                arr1
             </mx:value>
          </mx:SetProperty>
       </mx:State>
       <mx:State name="state2">
          <mx:SetProperty name="dataprovider" target="{horizontalList}">
             <mx:value>
                arr2
             </mx:value>
          </mx:SetProperty>
       </mx:State>
    </mx:states>
    <mx:HorizontalList id="horizontalList"
      dataProvider="{arr1}"
    />
    This code doesn't work, the mx:Value is probably not what I need. Any suggestions how to fix this ?
    thnx
    Luca

    Hi Luca,
    Try the code below...
    Instead of  <mx:value>arr1</mx:value> assign the value in the SetProperty tag itself....as shown below
    <mx:SetProperty name="dataProvider" target="{horizontalList}" value="{arr1}">
    </mx:SetProperty>
    Also you have used the name of the property as dataprovider instead of dataProvider.(P should be uppercase)
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Array id="arr1">
      <mx:Object data='bar' label="bar1"/>
      <mx:Object data='bar' label="bar2"/>
      <mx:Object data='bar' label="bar3"/>
      <mx:Object data='bar' label="bar4"/>
      <mx:Object data='bar' label="bar5"/>
      <mx:Object data='bar' label="bar6"/>
    </mx:Array>
    <mx:Array id="arr2">
      <mx:Object data='bar' label="bar7"/>
      <mx:Object data='bar' label="bar8"/>
      <mx:Object data='bar' label="bar9"/>
      <mx:Object data='bar' label="bar10"/>
      <mx:Object data='bar' label="bar11"/>
      <mx:Object data='bar' label="bar12"/>
    </mx:Array>
    <mx:states>
        <mx:State name="state1">
           <mx:SetProperty name="dataProvider" target="{horizontalList}" value="{arr1}">
           </mx:SetProperty>
        </mx:State>
        <mx:State name="state2">
           <mx:SetProperty name="dataProvider" target="{horizontalList}" value="{arr2}">
           </mx:SetProperty>
        </mx:State>
    </mx:states>
    <mx:HorizontalList id="horizontalList"  dataProvider="{arr1}" labelField="label" height="100"/>
    <mx:HBox horizontalGap="5" top="200">
      <mx:Button id="btn1" label="Go to State1" click="this.currentState='state1'" />
      <mx:Button id="btn2" label="Go to State2" click="this.currentState='state2'" />
    </mx:HBox>
    </mx:Application>
    Thanks,
    Bhasker

  • AdvancedDataGrid changing dataprovider bug infinite loop

    Make the second column width like this image and then click on addRow1:
    <code>
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    >
    <fx:Declarations>
    <s:ArrayCollection id="dp">
    <fx:Object descripcion="descripcion1" />
    <fx:Object descripcion="descripcion2" />
    <fx:Object descripcion="descripcion3" />
    <fx:Object descripcion="descripcion4" />
    </s:ArrayCollection>
    </fx:Declarations>
    <fx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    protected function btnAceptar_clickHandler(event:MouseEvent):void {
    var aux:ArrayCollection = new ArrayCollection(dp.toArray());
    var obj:Object = new Object();
    obj.descripcion = "descripcion" + dp.length;
    aux.addItem(obj);
    dp = aux;
    protected function button1_clickHandler(event:MouseEvent):void {
    var obj:Object = new Object();
    obj.descripcion = "descripcion" + dp.length;
    dp.addItem(obj);
    ]]>
    </fx:Script>
    <s:layout>
    <s:VerticalLayout />
    </s:layout>
    <s:Panel>
    <mx:AdvancedDataGrid id="grilla" dataProvider="{dp}" width="100%" height="100%"
    horizontalScrollPolicy="auto"
    >
    <mx:columns>
    <mx:AdvancedDataGridColumn dataField="descripcion" />
    <mx:AdvancedDataGridColumn dataField="descripcion" />
    </mx:columns>
    </mx:AdvancedDataGrid>
    </s:Panel>
    <s:Button label="addRow1" click="btnAceptar_clickHandler(event)" />
    <s:Button label="addRow1" click="button1_clickHandler(event)" />
    </s:Application>
    </code>

    When the width property is not used, it fails. I can't simplify more than this sorry.
    Steps:
    click on Fail button
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application
         xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/mx"
         width="300" height="300"
         >
         <fx:Declarations>
              <s:ArrayCollection id="dp">
                   <fx:Object description1="description" description2="description"/>
                   <fx:Object description1="description" description2="description"/>
                   <fx:Object description1="description" description2="description"/>
                   <fx:Object description1="description" description2="description"/>
              </s:ArrayCollection>
         </fx:Declarations>
         <fx:Script>
              <![CDATA[
                   import mx.collections.ArrayCollection;
                   protected function fail_clickHandler(event:MouseEvent):void {
                        var obj:Object = new Object();
                        obj.descripcion = "description";
                        var aux:ArrayCollection = new ArrayCollection(dp.toArray());
                        aux.addItem(obj);
                        dp = aux;
              ]]>
         </fx:Script>
         <s:layout>
              <s:VerticalLayout />
         </s:layout>
         <mx:AdvancedDataGrid id="grid" dataProvider="{dp}" height="160" horizontalScrollPolicy="auto">
              <mx:columns>
                   <mx:AdvancedDataGridColumn dataField="description1" width="200"/>
                   <mx:AdvancedDataGridColumn dataField="description2" width="5"/>
              </mx:columns>
         </mx:AdvancedDataGrid>
         <s:Button id="fail" label="FAIL" click="fail_clickHandler(event)" />
    </s:Application>

Maybe you are looking for

  • HELP?  webdynpro for abap - office integration??

    Hi ALL:      Do you know how to use the cl_wd_office_control ?     I  use 'WORD' or 'EXCEL' to display with webdynpro application and change the data ,now,i want to save the data into SERVER (word or excel).the action 'ON_SAVE' how to write? Thanks i

  • Remote debugging an executable with dynamically loaded subpanel VIs

    All, A colleague of mine is attempting to perform remote debugging of an executable he has inherited. It includes subpanels that show dynamically loaded VIs. When connecting with the remote debugger, the main executable shows fine, but the dynamicall

  • Substitution run time variable format

    Dear All: Here is a simple sqlplus command line with & for substitution variable: set verify off; SQL> SELECT * FROM emp where sal >&SAL; Enter value for sal: Now as you see, oracle asks to Enter Value for substitution variable in line just below the

  • Diff btwn contracts and scheduling agreements????

    hi buddies..... i have facing this question in lot of interviews but cant able to answer properly.... plz gimme some interview point of view answers... thanks in advance... venkatesh.v

  • Mac OS X 10.6 Install media

    I buy a Mac Mini. The previous owner forgot the admin password. I don't have the installation / recovery disks, and I like to reformat an reinstall everything. Where I can find the recovery disk to download, or how I can reset the password?