0 Replies Latest reply on Dec 1, 2016 1:56 AM by akshay4792

    Flex datagrid with checkbox in One column

    akshay4792 Level 1

      Hi,

      I have Datagrid with one columb as checkboxes, Datagrid has itemDoubleClick event and checkbox has click event.

       

      but i want to have doubleclick event as well for checkbox. but everytime i double click a checkbox , it also calls itemDoubleClick event of datagrid.........

       

      i dont want to call itemDoubleClick event when i doubleclick checkbox???

       

      solution

       

      MXML File

       

      <mx:DataGrid id="IdDGMerEditLocations" left="10" right="10" top="50" bottom="10"

                                       dataProvider="{arrLocEdit}" doubleClickEnabled="true"

                                       doubleClick="IdDGMerEditLocations_itemDoubleClickHandler(event)"

                                       styleName="dataGridStyle" fontFamily="Open Sans"    color="#000000" headerHeight="29" chromeColor="#5D5D5D" borderStyle="none" verticalGridLines="false" variableRowHeight="true">

                              <mx:columns>

                                  <mx:DataGridColumn visible="false" dataField="locId"

                                                     headerText="Location Id"/>

                                  <mx:DataGridColumn visible="true" width="180" dataField="nameLoc"

                                                     fontFamily="Arial" fontSize="12" fontWeight="bold"

                                                     headerStyleName="boldWhite" headerText="Location"

                                                     resizable="false" sortable="true" textAlign="left"

                                                     textIndent="10" wordWrap="true"/>

                                  <mx:DataGridColumn visible="true" width="200" dataField="addLine1Loc"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerStyleName="boldWhite" headerText="Addr Line1"

                                                     resizable="false" sortable="false" textAlign="left"

                                                     textIndent="10" wordWrap="true"/>

                                  <mx:DataGridColumn visible="true" width="100" dataField="addLine2Loc"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerStyleName="boldWhite" headerText="Addr Line2"

                                                     resizable="false" sortable="false" textAlign="left"

                                                     textIndent="10" wordWrap="true"/>

                                 

                                  <mx:DataGridColumn visible="true" width="110" dataField="phoneLoc"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerStyleName="boldWhite" headerText="Phone"

                                                     resizable="false" sortable="false" textAlign="left"

                                                     textIndent="10" wordWrap="true"/>

                                 

                                  <mx:DataGridColumn visible="true" width="60" dataField="zipCodeLoc"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerStyleName="boldWhite" headerText="ZIP Code"

                                                     resizable="false" sortable="true" textAlign="right"

                                                     textIndent="10" wordWrap="true"/>

                                  <mx:DataGridColumn visible="false" dataField="country.nameCountry"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerText="Country" resizable="false"

                                                     sortable="false" textAlign="left" textIndent="10"

                                                     wordWrap="true"/>

                                  <mx:DataGridColumn visible="false" dataField="stateDomain.stateName"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerText="State" resizable="false" sortable="false"

                                                     textAlign="left" textIndent="10" wordWrap="true"/>

                                  <mx:DataGridColumn visible="false" dataField="stateDomain.stateId"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerText="StateId" resizable="false"

                                                     sortable="false" textAlign="left" textIndent="10"

                                                     wordWrap="true"/>

                                  <mx:DataGridColumn visible="false" dataField="city.cityName"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerText="City" resizable="false" sortable="false"

                                                     textAlign="left" textIndent="10" wordWrap="true"/>

                                  <mx:DataGridColumn visible="false" width="60" dataField="serviceDineIn"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerStyleName="boldWhite" headerText="DineIn"

                                                     resizable="false" sortable="true" textAlign="center"

                                                     textIndent="0" wordWrap="false"/>

                                  <mx:DataGridColumn visible="false" width="60" dataField="serviceTakeout"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerStyleName="boldWhite" headerText="Takeout"

                                                     resizable="false" sortable="true" textAlign="center"

                                                     textIndent="0" wordWrap="false"/>

                                  <mx:DataGridColumn visible="false" width="60" dataField="serviceDelivery"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerStyleName="boldWhite" headerText="Delivery"

                                                     resizable="false" sortable="true" textAlign="center"

                                                     textIndent="0" wordWrap="false"/>

                                  <mx:DataGridColumn visible="true" width="60" dataField="statusLoc"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerStyleName="boldWhite" headerText="Activated"

                                                     resizable="false" sortable="true" textAlign="center"

                                                     textIndent="0" wordWrap="false" >

                                      <mx:itemRenderer><fx:Component>

                                                           <mx:VBox horizontalAlign="center">

                                                              

                                                               <fx:Script>

                                                                   <![CDATA[

                                                                       import mx.collections.ArrayCollection;

                                                                       import mx.controls.Alert;

                                                                       import mx.controls.CheckBox;

                                                                       import mx.core.FlexGlobals;

                                                                       import mx.utils.ObjectUtil;

                                                                       [Bindable]

                                                                       public var cbSelected:Boolean;

                                                                      

                                                                      

                                                                       protected function IdChkstatusLoc_clickHandler(event:MouseEvent):void

                                                                       {

                                                                           // TODO Auto-generated method stub

                                                                           data.statusLoc = IdChkstatusLoc.selected

                                                                           outerDocument.activeDeactiveLocation(IdChkstatusLoc.selected);

                                                                           //Alert.show("IdChkstatusLoc_clickHandler" +IdDGMerEditLocations.selectedIndex+ObjectUtil.toString(arrLocEditTemp));

                                                                          // Alert.show("Single Click ");

                                                                       }

                                                                       protected function IdChkstatusLoc_doubleClickHandler():void{

                                                                          // Alert.show("Double Click ");

                                                                       }

                                                                      

                                                                   ]]>

                                                               </fx:Script>

                                                              

                                                               <s:CheckBox id="IdChkstatusLoc"

                                                                           chromeColor="white"

                                                                           click="data.statusLoc = IdChkstatusLoc.selected"

                                                                           selected="{data.statusLoc}"

                                                                           skinClass="assets.skins.CustomCheckBoxSkin"

                                                                           symbolColor="white"                                                         

                                                                           doubleClick="IdChkstatusLoc_doubleClickHandler()"  doubleClickEnabled="false" />  

                                                           </mx:VBox>

                                                       </fx:Component></mx:itemRenderer>

                                  </mx:DataGridColumn>

                                 

                                  <mx:DataGridColumn visible="false" width="60" dataField="faxSelect"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerStyleName="boldWhite" headerText="Fax Enable"

                                                     resizable="false" sortable="true" textAlign="center"

                                                     textIndent="0" wordWrap="false"/>

                                  <mx:DataGridColumn visible="false" width="60" dataField="smsSelect"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerStyleName="boldWhite" headerText="SMS Enable"

                                                     resizable="false" sortable="true" textAlign="center"

                                                     textIndent="0" wordWrap="false"/>

                                  <!-- 4 july 2015 -->

                                  <mx:DataGridColumn visible="true" width="60" dataField="posLoc"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerStyleName="boldWhite" headerText="Is Pos"

                                                     resizable="false" sortable="true" textAlign="center"

                                                     textIndent="0" wordWrap="false"/>

                                 

                                  <!-- 4 july 2015 end -->

                                  <!-- 18 feb 2016 -->

                                  <mx:DataGridColumn visible="true" width="75" dataField="noOfPosLicence"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerStyleName="boldWhite" headerText="#Purchased"

                                                     resizable="false" sortable="true" textAlign="center"

                                                     textIndent="0" headerWordWrap = "true"/>

                                 

                                  <mx:DataGridColumn visible="true" width="75" dataField="noOfPosLicenceUsed"

                                                     fontFamily="Arial" fontSize="12" fontWeight="normal"

                                                     headerStyleName="boldWhite" headerText="#Used"

                                                     resizable="false" sortable="true" textAlign="center"

                                                     textIndent="0" headerWordWrap = "true"/>

                                 

                                  <mx:DataGridColumn visible="true" width="50" fontFamily="Arial"

                                                     fontSize="12" fontWeight="normal"

                                                     headerStyleName="boldWhite" headerText="Delete"

                                                     resizable="false" sortable="false" textAlign="center"

                                                     textIndent="0" wordWrap="false">

                                      <mx:itemRenderer><fx:Component>

                                                           <mx:HBox horizontalAlign="center">

                                                              

                                                               <fx:Script>

                                                                   <![CDATA[

                                                                       import mx.controls.Alert;

                                                                       import mx.core.Application;

                                                                       import mx.core.FlexGlobals;

                                                                       import mx.events.CloseEvent;

                                                                      

                                                                       protected function del_clickHandler(event:MouseEvent):void

                                                                       {

                                                                           /*  Alert.show( "Confirm record delete", "Warning",

                                                                           Alert.YES | Alert.NO, this, closeHandler, outerDocument.iconWarning,  Alert.YES ); */

                                                                          

                                                                           outerDocument.deleteAlert();

                                                                       }

                                                                      

                                                                      

                                                                      

                                                                   ]]>

                                                               </fx:Script>

                                                              

                                                              

                                                               <mx:Image id="IdImgdel" buttonMode="true"

                                                                         click="del_clickHandler(event)"

                                                                         source="assets/u121_original.PNG"/>

                                                              

                                                           </mx:HBox>

                                                       </fx:Component></mx:itemRenderer>

                                  </mx:DataGridColumn>

                                 

                                  <!-- 18 feb 2016 end -->

                                  <!--<mx:DataGridColumn visible="false" width="60" dataField="faxLoc"

                                  fontFamily="Arial" fontSize="12" fontWeight="normal"

                                  headerStyleName="boldWhite" headerText="Fax"

                                  resizable="false" sortable="true" textAlign="center"

                                  textIndent="0" wordWrap="false"/>-->

                                 

                              </mx:columns>

                             

                          </mx:DataGrid>