3 Replies Latest reply on Mar 13, 2008 2:49 PM by Laurence Middleton

    checkboxes in datagrid

    $haan
      I have a datagrid with two columns. when an item is selected on this datagrid, another datagrid gets populated based on the selected item. But as things stand, the second dgrid is inside a repeater. This dgrid has a custom checkbox as an itemrenderer. When a checkbox is checked a chart is to be populated based on this data.

      The problem now is: The view gets updated only after an extra click event after checking a checkbox.

      Is there any way to update the view as soon as the checkbox is checked ?

      Thanks



      <mx:TabNavigator id="svc1" x="35.5" y="200" width="930.5" height="414">
      <mx:Repeater id= "r" dataProvider="{servicelist}" >
      <mx:Canvas id="nameLabel"
      label="{r.currentItem.service_name}"
      width="928" height="302">
      <mx:DataGrid id="tk" x="1" y="0" width="270" height="302" dataProvider="{r.currentItem.tasks.task}"
      itemClick="taskSelected(event);" >
      <mx:columns>
      <mx:DataGridColumn editable="true" itemRenderer="mx.controls.CheckBox" rendererIsEditor="false" width="17"/>
      <mx:DataGridColumn headerText="tasks" dataField="task_name"/>
      <mx:DataGridColumn headerText="taskeffort" />
      </mx:columns>
      </mx:DataGrid>
      <mx:ViewStack id="vs" selectedIndex="0" width="647" x="271">
      <mx:Repeater id="acrep" dataProvider="{r.currentItem.tasks.task}" >
      <mx:Canvas id="can" width="691" height="100%" >

      <mx:DataGrid id="act" itemEditEnd="pro(event)" x="0" y="0" width="366" height="302" dataProvider= "{(ArrayCollection)(totActs.getItemAt(r.currentIndex)).getItemAt(acrep.currentIndex).acti vity}" editable="true">
      <mx:columns>
      <mx:DataGridColumn dataField="sel" itemRenderer="selector" editorDataField="bool" editable="true" rendererIsEditor="true"/>
      <mx:DataGridColumn width="300" headerText="Activities" dataField="name" editable="false" />
      <mx:DataGridColumn width="177" headerText="Effort" dataField="effort" editable="false" />
      </mx:columns>
      </mx:DataGrid>

      <mx:PieChart id="pie" dataProvider="{(ArrayCollection)(totActs.getItemAt(r.currentIndex)).getItemAt(acrep.curre ntIndex).activity}" x="374" width="248" height="250" y="29">

      <mx:series>
      <mx:PieSeries
      field="effort"
      nameField="name"
      labelPosition="callout"
      />
      </mx:series>
      </mx:PieChart>
      </mx:Canvas>
      </mx:Repeater>
      </mx:ViewStack>
      </mx:Canvas>
      </mx:Repeater>
      </mx:TabNavigator>
        • 1. Re: checkboxes in datagrid
          $haan Level 1
          is this topic so lame that nobody is willing to comment on it?? or am i doing it all wrong? if so plz point out.
          • 2. Re: checkboxes in datagrid
            Gregory Lafrance Level 6
            I wanted to take a look at this, but your sample code would best include everything necessary to reproduce, and at least some things are left to the imagination, and I don't have the time to figure it out. examples are servicelist and
            taskSelected, but there is other missing info.
            • 3. Re: checkboxes in datagrid
              Laurence Middleton
              This may not solve it, but a co-worker discovered with a ComboBox in an DataGrid column the other day that he couldn't just mark the DataGridColumn holding the ComboBox as editable="true". He found he had to mark the parent DataGrid as editable="true", then mark all the OTHER DataGridColumn elements (displaying text which should not be edited) as editable="false".

              Good luck...