0 Replies Latest reply on Feb 25, 2009 6:31 AM by Sankar Kethineni

    Issue with CheckBox

    Sankar Kethineni
      Hi All,

      In my application am using the List Control and the itemRenderer to display the data which comes from the DataBase.On creationComplete of my parent component(List component exists here),am calling a method which gets the data from the database and i have a creationComplete event for my itemRenderer also.

      If i do add to list and even for a small change in the items every time creationComplete event gets fired of itemrenderer component except for the updating an item and for removing an item ,since, for an item renderer or item editor, Flex might reuse an instance of the item renderer or item editor and a reused instance of an item renderer or item editor does not redispatch the creationComplete event.

      Am displaying all my items along with the checkbox and now when i click on the checkbox,am setting item to enabled=false and calling update method to set the status flag(by default 0) value to 1 to update in the database.When i unselect the checkbox am doing the reverse (setting enabled = true) and this time also creationComplete of itemRenderer getting fired.

      Now the problem is that,when i select the checkbox ,item getting enabled(false) and it's suddenly setting to enabled=true without unchecking the
      checkbox and for the second time it work's properly and for third time it won't and like that it is behaving alternatively.All this happening on click event of CheckBox and i tried with change event also but it doesn't help me.

      And also I can add multiple new items to List and i can't add after updating or removing an existing item.If i reload the application then i can add the new items.s

      can any one help me how to solve this problem ? Any help can be Appriciated.

      Thanks in advance.

      <mx:CheckBox id="cbStatus" click="clickChkBox(event)"/>

      private function clickChkBox(event:Event):void {
      if (cbStatus.selected) {
      todoItem.status = 1;
      else {
      todoItem.status = 0;

      updateItem(event); // here am dispatching the event and in my parent component am calling actual backend method to update in DB and getting
      the result back in my ResultEventHandler.
      //and am calling afterUpdateMethod to set item to enabled = false/true based on checkbox selected value

      private function afterUpdate():void {
      if (cbStatus.selected) {
      name.enabled = false;
      dob.enabled = false;
      else {
      name.enabled = true;
      dob.enabled = true;

      But it doesn't help me !