0 Replies Latest reply on Aug 5, 2014 2:16 PM by hasa890

    use spacebar to check/uncheck a checkbox in a datagrid.

    hasa890

      I have a DataGrid that has checkbox in the first column. The user wants to be able to check/uncheck the checkbox when he selects a row, by mouse or up and down keys, and hits the spacebar. Currently the spacebar functions if the last thing that the use has clicked on is the Checkbox. If the user clicks in the cell where the checkbox in located(not the checkbox itself), the spacebar won't do anything.

       

      <mx:TabNavigator>

           <mx:VBox>

                <ms:datagrid id="lgGrid" dataProvider="{this.lData}">

                     <mx:columns>

                          <mx:Array>

                               <mx:DataGridColumn dataField="vis" id="dfID" sortable="false">

                                    <mx:itemRenderer>

                                         <mx:Component>

                                              <mx:CheckBox click="data.vis = !data.vis"  paddingLeft="4"/>

                                         </mx:Component>

                                    </mx:itemRenderer>

                                </mx:DataGridColumn>

                                <mx:DataGridColumn dataField="name"/>

                          </mx:Array>

                     </mx:columns>

                </ms:datagrid

         </mx:VBox>

      </mx:TabNavigator>