2 Replies Latest reply on Apr 20, 2009 6:31 PM by The ScareCrow

    Complex DataGrid

    The ScareCrow Level 1

      I have a complex datagrid

       

      The datagrid has a column that is a datagrid (ie. the itemrender is a datagrid itself.

      If anyone knows of a tutorial for this please let me know.

       

      Anyway it all works as expected and values are updated.

      Problem is I only want to have a single save button on the outer grid.

      I want this button to call a function to save the datagrid rows.  But as one column is a datagrid I also want it to call a function in the itemrenderer that will save the itemrenderer datagrid (make sence ?)

       

      Does anyone know how to call a public function of an itemRenderer from the parent component ?

       

      Or if I'm not doing this correctly, can you let me know !

       

       

       

       

       

       

       

       

       

       

       

      <mx:DataGridColumn

      dataField="

      fld_competency_id" headerText="Competency" editable="true" width="200" rendererIsEditor="true"

      itemRenderer="

      com.cfgenerated.views.renderers.PDP_Development_Competency" editorDataField="newCompentencies">

       

       

      </mx:DataGridColumn>

       

      Ken

        • 1. Re: Complex DataGrid
          ATIF FAROOQ Level 3

          hi,

             you can use indexToItemRenderer and itemToItemRenderer property of dataGrid to get particular ItemRenderer instance and call its public methods later on.

          • 2. Re: Complex DataGrid
            The ScareCrow Level 1

            Thanks for the reply,

             

            I have tried this but it appears that the function is not executed.

             

            Some code

             

            The page that has the item renderer has a button with a click event that calls

             

             

             

            private function saveItem():void

            {

             

             

            var pdpda:PDP_Development_Activities = this.masterList.indexToItemRenderer(2) as PDP_Development_Activities;

            pdpda.saveActivities();

            }

             

             

            The public function in the item renderer is

             

            public function saveActivities():void

            {

            Alert.show( ObjectUtil.toString('save the activities...') );

            }

             

            But the alert is never shown.

             

            Ken

             

             

            Edit:

            This actually works if the datagrid column is column zero (0).  But as soon as I move it back it does not work.

            The datagrid has 4 columns and each column has an itemrenderer.

            So column 3 (referenced as 2) has the itemrender that is a datagrid, which is the one I need this to work on.

             

            Message was edited by: The ScareCrow