2 Replies Latest reply on Nov 4, 2006 9:14 PM by fatkid250

    selectedItem Problem

      the problem I am having involves the code pasted below.

      I am getting the warning messages (Data binding will not be able to detect changes when using square bracket operator. For Array, please use ArrayCollection.getItemAt() instead.)

      this is refering to the lines of code for the text boxes which have the data from the selected item in the datagrid loaded into them.

      the part which is causing the warning is text="{grid.selectedItem[1]}" (note: the date field has to be a number as the datafeed I am using the separate fields are not named, normally would use grid.selectedItem,somename but not possible in this instance)

      if I use {grid.selectedItem.1} it gives a 1084:syntax error: expecting rightparen before .1. so there for changed it to {grid.selectedItem[1]} which got rid of the 1084 but gave me the warning.

      is there something I am missing or a way round this, or am I just going to have to live with this warning

      any feedback would be greatly appreciated.



      <mx:Panel layout="absolute" left="10" right="10" top="10" height="517">

      <mx:DataGrid id="grid" right="10" left="10" top="10" bottom="200">
      <mx:DataGridColumn headerText="Name" dataField="1"/>
      <mx:DataGridColumn headerText="Date" dataField="2"/>
      <mx:DataGridColumn headerText="Category" dataField="3"/>
      <mx:DataGridColumn headerText="Competition" dataField="5"/>
      <mx:DataGridColumn headerText="Venue" dataField="6"/>
      <mx:DataGridColumn headerText="Type" dataField="8"/>
      <mx:DataGridColumn headerText="ID" dataField="9"/>

      <mx:Text x="10" y="291" text="ID:" fontWeight="bold"/>
      <mx:Text x="96" y="291" text="{grid.selectedItem[9]}" width="139"/>

      <mx:Text x="96" y="317" width="140" text="{grid.selectedItem[1]}"/>
      <mx:Text x="10" y="317" text="Name:" width="59" fontWeight="bold"/>

      <mx:Text x="10" y="343" text="Date:" width="44" fontWeight="bold"/>
      <mx:Text x="96" y="343" width="141" text="{grid.selectedItem[2]}"/>

      <mx:Text x="10" y="369" text="Category:" fontWeight="bold"/>
      <mx:Text x="96" y="369" width="139" text="{grid.selectedItem[3]}"/>

      <mx:Text x="10" y="395" text="Competition:" fontWeight="bold"/>
      <mx:Text x="96" y="395" text="{grid.selectedItem[5]}"/>

      <mx:Text x="10" y="421" text="Venue:" width="44" fontWeight="bold"/>
      <mx:Text x="96" y="421" text="{grid.selectedItem[6]}" width="139"/>

      <mx:Text x="10" y="447" text="Type:" width="61" fontWeight="bold"/>
      <mx:Text x="96" y="447" text="{grid.selectedItem[8]}" width="139"/>

        • 1. Re: selectedItem Problem
          ntsiii Level 3
          You will be happiest if you can use an ArrayCollection of Objects for your dataProvider.

          How are you building the dataProvider?


          • 2. Re: selectedItem Problem
            what i tend to do is grab the column name? i'm a little confused on what your trying to do... from the general concept of what i see of your code, your trying to fill text boxes with the selected item of the datagrid to make it editable or something like that? correct me if i'm wrong please...

            but what i do is, instead of using "datagrid.selectedItem[1]"
            I use "datagrid.selectedItem.columnName" and i dont get that error that you are getting,

            I do happen to get that error on my own venture, when trying some things with remoting and trying to grab something from a query that i return from remoting with a coldfusion component.

            check out my blog from time to time, you might like it, I'm finishing a full on flex project for work, it's not for a client, it's just to finish and make sure i have my learning curve done for flex...


            you can also email me at