1 Reply Latest reply on Sep 8, 2010 10:42 AM by majester8425

    How do I pass datagrid elements from a component to a function ?

    majester8425 Level 1

      I have a datagrid which I scroll through the data provider for and dynamically build XML. The code below works great, but now I am faced with having 18 data grids that I have to process in the same way. Its easy just to copy the code 18 times and just change the elements I want, but that seems stupid. I am still learning this stuff, so excuse my stupidity.

       

      for (i = 0; i < distComp.distGrid.dataProvider.length; i++)

      {

      F = distComp.distGrid.dataProvider.getItemAt(i).dbsf_id;

            dynamicXML = <ELEMENT/>;

            dynamicXML.DISTRIB = F;

            saveXML.appendChild(dynamicXML);

      }

       

      What I am hoping to do is have a function that I can call which does the processing

       

      Something like

       

      processXmlValues(dataGridDataProvderPlaceholder, elementName:String):void

      {

      F = dataGridDataProvderPlaceholder.getItemAt(i).dbsf_id;

       

      }

       

      I tried using ArrayCollection for dataGridDataProvderPlaceholder, but that just gives me an unrelated type error.