3 Replies Latest reply on Apr 10, 2008 6:14 PM by chris.huston.t10

    item editor


      I am using an itemEditor for a list control with three check boxes in it.
      the data provider for list is an XML

      i am not able to update the xml when i click checkbox.
      the alert for myList,dataprovider shows the updated result..but still sinally shows up the previousl values which to my knowledge what is happening here is it is updating myList.dataprovider but not the actual XML...

      i am struggling from last two days..please please help me out with this..

      my itemeditor is

      <?xml version="1.0" encoding="utf-8"?>
      <mx:HBox xmlns:mx=" http://www.adobe.com/2006/mxml" height="100%" width="100%" >
      <mx:Label text="{data.name}" id="setEntity"/>
      <mx:CheckBox id="read" label="READ" selected="{data.READ}" click="data.READ=read.selected"/>
      <mx:CheckBox id="write" label="WRITE" selected="{data.WRITE}" click="data.WRITE=write.selected"/>
      <mx:CheckBox id="reassign" label="REASSIGN" selected="{data.REASSIGN}" click="data.REASSIGN=reassign.selected"/>

      and Main APPlication is

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">

      import mx.collections.XMLListCollection;
      import Components.CheckBoxRenderer;
      import mx.events.ListEvent;
      import mx.controls.Alert;

      private var myUsers:XML =
      <User id="1">

      <User id="2">

      <User id="3">

      public function init():void{
      myList.dataProvider = myUsers.User;

      public function processData(event:ListEvent):void{

      // Disable copying data back to the control.

      // Get new permissions from editor.
      myList.editedItemRenderer.data.READ =

      myList.editedItemRenderer.data.WRITE =

      myList.editedItemRenderer.data.REASSIGN =

      //close the cell editor

      //notify to update

      Alert.show(""+myList.dataProvider)//shows the updated values correctly..but in the display i get back the previous values

      <mx:List id="myList"
      height="250" width="500"



      Thanks ..

        • 1. Re: item editor
          smscentral Level 1

          why is there no reply?
          can anyone please go through this....
          • 2. Re: item editor
            ntsiii Level 3
            The dataProvider is a reference to the xml, so they are the same. The xml is being updated. alert myUsers.toXMLString() to see.

            The problem is probably that the component is not being refreshed after the changes.

            What are you doing in the processData function?

            • 3. Re: item editor
              chris.huston.t10 Level 3
              The problem you are having is with the assignment of the selected property of your checkboxes. You are using a string value of 'true' or 'false' which will always evaluate to a Boolean value of true. All XML data is of type string, so you need to convert the value to a Boolean to use it in your ItemEditor. So instead of selected="{data.READ}" you would use selected="{data.READ=='true'}" and so on. The full ItemEditor is listed below.

              <?xml version="1.0" encoding="utf-8"?>
              <mx:HBox xmlns:mx=" http://www.adobe.com/2006/mxml" height="100%" width="100%" >
              <mx:Label text="{data.name}" id="setEntity"/>
              <mx:CheckBox id="read" label="READ" selected="{data.READ=='true'}" click="data.READ=read.selected"/>
              <mx:CheckBox id="write" label="WRITE" selected="{data.WRITE=='true'}" click="data.WRITE=write.selected"/>
              <mx:CheckBox id="reassign" label="REASSIGN" selected="{data.REASSIGN=='true'}" click="data.REASSIGN=reassign.selected"/>