2 Replies Latest reply on Apr 21, 2009 12:11 PM by GeorgeWS

    itemUpdated and CheckBox

    GeorgeWS Level 1

      I have a datagrid filled from a RO. There are a bunch of form fields outside of the Datagrid. When I press on a record the fields get filled in. That works perfect. One of the fields is a combobox. So I change some things in the fields and do an update. I update a DB and also use the itemUpdate to keep everything matching the screen to the DB. When I click to another record and then back the fields are changed and most all is perfect. The only thing I cannot do is get the Checkbox to Update. I press on the checkbox press an update button and the click to another record and then back and the checkbox does not show me if I selected "true" The DB updates just the Checkbox does not represent the data.


      This is fired when the update button is pressed:


      public function updateVehicle():void {
              if (mainList.selectedItem !== null) {
                  vehicleList.setItemAt({ID:ID.text, Vin:Vin.text,



                      }, mainList.selectedIndex);
                      var currentlySelectedItem : Object = mainList.selectedItem;
                currentlySelectedItem.Vin =  Vin.text;
                currentlySelectedItem.State =  State.text;
                currentlySelectedItem.Plate =  Plate.text;
                currentlySelectedItem.Brand =  BrandID.text;
                currentlySelectedItem.Brand2 =  BrandID2.text;
                currentlySelectedItem.DrCheck =  DrCheck.selected;
                currentlySelectedItem.PsCheck =  PsCheck.selected;
                Alert.show("The database has been updated.")


      DrCheck and PsCheck are the id's of the checkboxs. the Brand and Brand2 are comboboxs (works great) and the rest are textinputs. I know I asked a very similar question the other day. Once you get one thing (2 days) 5 minutes goes by and stuck again. If I didnt love CF and Flex so much Id hate it.





        • 1. Re: itemUpdated and CheckBox
          Flex harUI Adobe Employee

          Show us the code that updates the ComboBoxes and CheckBoxes


          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          • 2. Re: itemUpdated and CheckBox
            GeorgeWS Level 1

            On my original post has the update function that gathers the fields data to send to an update function, the second half of the function does the the itemUpdate. The BrandID and BrandID2 are for the comboboxs and the DrCheck and PsCheck are for the Checkboxs:


            <mx:ComboBox id="BrandID" prompt="Select a Brand" dataProvider="{newBrands}" selectedItem="{BrandID.text}" labelField="label" width="150"


            <mx:CheckBox label="Pending" id="DrCheck" themeColor="#73B9B9"/>


            When the program first loads I can pick in a DG and it changes the ComboBox to match whats in the ArrayCollection. That part is working. The Checkbox does not. Seems like I have it right, just does not get the true false values back into the collection. So when I make a change like check a box and press update the DB updates but if I leave the row and then select back on the first record the checkbox is always false, unless I reload all the data.