0 Replies Latest reply on Mar 25, 2008 12:27 AM by leeng

    bug in drop-in ItemRenderer?

    leeng
      Hello,

      In all the examples I have seen online most of the Drop-In ItemRenderers use an ArrayCollection when a CheckBox is used as the DataProvider. I tried using an XMLList collection instead and I don't get any of the CheckBoxes in the ItemRenderer to be checked when the value is true, by default they all appear as unchecked. I've tested the values displayed when I take out the ItemRenderer and they show true or false.

      I've tried to see if it made a difference that the values were either text nodes or attr nodes and it didn't seem to care. So is this a problem with the Drop-in ItemRenderer? Is this expected behavior? Do I need to create a LabelFunction to cast the XML value as a boolean? (I tried and it didn't work either)

      I'm kinda baffled and would appreciate any help.

      Thanks,
      Hoyt

      The code is very simple:

      XML file:

      <root>
      <test>
      <testValues>
      <boolval attr="false">true</boolval>
      <boolval attr="true">false</boolval>
      <boolval attr="true">true</boolval>
      <boolval attr="true">false</boolval>
      </testValues>
      </test>
      </root>

      The mxml file:
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="testXML.send();" cornerRadius="8" borderStyle="solid" borderThickness="2" borderColor="#000000" themeColor="#00FF00" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#008080, #008080]">
      <mx:Script>
      <![CDATA[
      import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
      import mx.collections.HierarchicalData;
      import mx.binding.utils.ChangeWatcher;
      import mx.events.ListEvent;
      import mx.events.ItemClickEvent;
      import mx.controls.dataGridClasses.DataGridColumn;
      import mx.rpc.events.*;
      import mx.collections.XMLListCollection;
      import mx.controls.*;
      import mx.binding.*;
      import mx.binding.utils.BindingUtils;
      import mx.rpc.xml.*;

      [Bindable]
      private var testList:XMLListCollection;

      private function testXMLHandler(evt:ResultEvent):void {
      testList = new XMLListCollection(evt.result.test.testValues.boolval);
      txtArea.text += testList.toString();
      }

      ]]>
      </mx:Script>

      <mx:HTTPService id="testXML" result="testXMLHandler(event)" resultFormat="e4x" url=" http://localhost/~hoytng/Workspace/studentDB/xml/test.xml"/>
      <mx:DataGrid x="401" y="18" width="224" height="100" dataProvider="{testList}">
      <mx:columns>
      <mx:DataGridColumn headerText="Column 1" dataField="@attr"/>
      <mx:DataGridColumn headerText="Column 2" dataField="*"/>
      </mx:columns>
      </mx:DataGrid>
      </mx:Application>