1 Reply Latest reply on Dec 3, 2007 7:27 AM by Constantin Ehrenstein

    scope issues with inline item renderers

    Constantin Ehrenstein
      Hi there,

      I am using checkboxes for displaying list values, i.e. I have defined check boxes as item renderer / item editor like this:

      […]
      <mx:List dataProvider="{someDataProvider} rendererIsEditor="true" editorDataField="selected">
      <mx:itemRenderer>
      <mx:Component>
      <mx:CheckBox selected="{data.someBool}"/>
      </mx:Component>
      </mx:itemRenderer>
      </mx:List>
      […]

      Imagine this list in a form where you can edit some account data or the like. Now, I want two things to happen: First, whenever the checkbox is ticked or unticked, another button on the form for resetting the changes should be enabled. Second, since the checkbox component only occupies part of the list row, I want the check box to change also when the portion of the list row not belonging to the check box is clicked.

      Especially the first part gives me pain. The most reasonable thing to do is to insert a "change" EventHandler into the inline component, like

      <mx:CheckBox selected="{data.someBool}" change="onInlineItemChange(event)"/>

      Unfortunately, none of the methods or event handler functions defined in the Application / WindowedApplication / Window namespace are recognized, and the compiler throws an error.


      Any ideas?
      Best regards & thanks for your help
      C.
        • 1. scope issues with inline item renderers
          Constantin Ehrenstein Level 1
          Oh, and by the way: currently, when listening to "itemClick" for a List (or derived) component, there is no way to tell whether I clicked on the row or on the itemRenderer. Let's say I want to toggle the boolean item value when the row—not the check box—is clicked. With one not being discernible one from the other, the item wouldn't change when I clicked the inline item renderer check box, since the toggling would just revert the implicit changes made by the checkbox itself. Right now, both clicks fire exactly the same event, in this case with an opposite outcome.

          So I really think the item Renderer should be discernible from the list row. Do you know what I mean?

          Best wishes
          C.