8 Replies Latest reply on Sep 30, 2010 11:47 PM by Flex harUI

    checkbox in <fx:Component>

    savz Level 1

      hi,

       

          i want to use a checkbox in a datagrid for that i use the itemRender

       

      <mx:itemRenderer>
      <fx:Component>
        <mx:CheckBox change="checkBoxChange(event);"/>

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

       

      it give an error that

       

      :  Error: Call to a possibly undefined method checkBoxChange.

       

        <mx:CheckBox change="checkBoxChange(event);"/>

        • 1. Re: checkbox in <fx:Component>
          RUSH-ME Level 3

          Hi

           

          use <s:CheckBox change="outerDocument.checkbox1_changeHandler(event)"/>

           

          and make the function public

           

          Hope this helps

          Rush-me

          • 2. Re: checkbox in <fx:Component>
            Anitha Selvaraj Level 2

            Hi ,

             

            Place the method inside the fx:Component tag. Something like below:

             

                      <mx:itemRenderer>
                            <fx:Component>
                                <s:BorderContainer>
                                    <fx:Script>
                                        <![CDATA[
                                            private function checkBoxChange(event):void {
                                                //your code here
                                            }
                                        ]]>
                                    </fx:Script>
                                    <mx:CheckBox change="checkBoxChange(event);"/>
                                </s:BorderContainer>
                            </fx:Component>
                        </mx:itemRenderer>

             

            <fx:Script> cannot be followed by fx:Component. So I have added a BorderContainer and inside which place the script.

             

            Regards,

            Anitha

            • 3. Re: checkbox in <fx:Component>
              Syam..

              Hi

               

               

                   I used the same code in my program.But I got the following  error

               

               

              Type Coercion failed: cannot convert FeeDetailsUI::StudentFeeEditInnerClass0@b4a87851 to mx.controls.listClasses.IListItemRenderer.
                  at mx.controls.dataGridClasses::DataGridColumn/http://www.adobe.com/2006/flex/mx/internal::getMeasuringRenderer()

               

              Please give a solution.

               

               

               

               

               

               

               

              Regards

              Syam

              • 4. Re: checkbox in <fx:Component>
                Anitha Selvaraj Level 2

                Hi Syam,

                 

                Can you post your code.

                 

                Regard,

                Anitha

                • 5. Re: checkbox in <fx:Component>
                  Syam.. Level 1

                  This is the code i have uesd.

                   

                   

                  <mx:DataGridColumn  headerText="select"  dataField="selected" width="8" textAlign="center"   color="red">
                  <mx:itemRenderer>
                  <fx:Component>
                  <s:BorderContainer>
                                          <fx:Script>
                                              <![CDATA[
                                                  private function checkBoxChange(evt:Event):void
                                         {

                   


                                           var ch:CheckBox = evt.currentTarget as CheckBox;
                                           }
                                              ]]>
                                          </fx:Script>
                  <mx:CheckBox change="checkBoxChange(event);"/>
                                      </s:BorderContainer>
                  </fx:Component>
                  </mx:itemRenderer>
                  </mx:DataGridColumn>

                  • 6. Re: checkbox in <fx:Component>
                    Anitha Selvaraj Level 2

                    Please post the entire datagrid code. Because somewhere in the code, u are trying to convert the StudentFeeEditInnerClass object

                    • 7. Re: checkbox in <fx:Component>
                      Flex harUI Adobe Employee

                      I think it should be

                       

                      <s:BorderContainer implements="mx.controls.listClasses.IListItemRenderer"

                      • 8. Re: checkbox in <fx:Component>
                        Syam.. Level 1

                        This is the code

                         

                        <mx:DataGrid width="90%" height="60%"  dataProvider="{fee}" id="dgList" itemClick=" Change(event)" >

                         

                                                <mx:columns>

                         

                                                    <mx:DataGridColumn headerText="FeeType Id" dataField="feeTypeId" visible="false"/>

                         

                                                    <mx:DataGridColumn headerText="Fee Type" dataField="feeType"/>

                         

                                                    <mx:DataGridColumn headerText="Fee Amount" dataField="feeAmount"/>

                         

                         

                         

                        <mx:DataGridColumn  headerText="select"  dataField="selected" width="8" textAlign="center"   color="red">

                        <mx:itemRenderer>

                         

                        <fx:Component>

                         

                        <s:BorderContainer>

                         

                                                <fx:Script>

                         

                                                    <![CDATA[

                         

                                                        private function checkBoxChange(evt:Event):void

                         

                                               {

                         

                         

                         

                         

                                                 var ch:CheckBox = evt.currentTarget as CheckBox;

                         

                                                 }

                         

                                                    ]]>

                         

                                                </fx:Script>

                         

                        <mx:CheckBox change="checkBoxChange(event);"/>

                         

                                            </s:BorderContainer>

                         

                        </fx:Component>

                         

                        </mx:itemRenderer>

                         

                        </mx:DataGridColumn>

                         

                         

                         

                         

                         

                        Regards

                        Syam