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;
What I am hoping to do is have a function that I can call which does the processing
F = dataGridDataProvderPlaceholder.getItemAt(i).dbsf_id;
I tried using ArrayCollection for dataGridDataProvderPlaceholder, but that just gives me an unrelated type error.
I found my own solution
F = dataGridToProcess.dataProvider.getItemAt(i)[fieldElement]; dynamicXML =
F = dataGridToProcess.dataProvider.getItemAt(i)[fieldElement];
<ELEMENT/>; dynamicXML[xmlElementName] = F; saveXML.appendChild(dynamicXML);
dynamicXML[xmlElementName] = F;