I'm a sucker for creating problems. I'm working on adding role and simple content management to a customer website. Currently I'm having problems with the Role management page.
This is a legacy app and the customer is not willing to upgrade from Coldfusion 8 & Flex Builder 3 Professional, so "use the newer stuff" won't suffice for an answer. No, I didn't pick the colors and I do not have the authority to change them .
this is a populated example:
Here's the situation:
- The Role Management (mxml) page receives its data from a pair of xml files, siteManagement.xml and roleManagement.xml via cffile calls through a cfc
- The xml data is stored locally in XML vars until committed.
- If I click the 'Add Control' button once, edit the fields, and 'Save Changes' immediately (commits the changes to file via cfc), everything works as expected, except that the Roles combobox resets. This isn't normally a problem - it's often exactly the behavior you want, but I can't prevent the reset from happening.
- If I click 'Add Control' more than once between saving changes, changin any field on a new row causes all other rows to have the same value for the same field. (problem 2)
- this behavior can be fixed by saving and reloading the xml data between each 'Add Control' click. the problem with this solution is that it clears the Roles Combobox, adding unnecessary clicks to adding (sometimes many) controls to the datagrid.
Controls are added by adding a new child element to the XML var:
private function btnAddControl_click():void
var tempXML:XML = new XML;
tempXML = controlXMLTemplate;
rolesXML.role[cbRolePicker.selectedIndex].filename.(@fileName == cbChosenFile.selectedLabel).controls.appendChild(tempXML);
Alert.show("Something didn't work...","Error Adding Control:");
dgcControlLabel.editable = true;
dgcControlID.editable = true;
dgcControlType.editable = true
//suposed to select the new row - it doesn't
dgControls.selectedIndex = rolesXML.role[cbRolePicker.selectedIndex].filename.(@fileName == cbChosenFile.selectedLabel).controls.control.length(); xmlDisplay.text = rolesXML;
where controlXMLTemplate is:
<control controlID="control ID" controlLabel="control Label" controlType="type" editable="false" visible="false" />
and is added to the filename element:
<filename canAccess="true" fileName="" friendlyName="">
I don't know what is causing the issue with the datagrid where editing one row causes changes in the others. My first thought was that it's caused by making all changes and selections via xml calls e.g;
dgControls.dataProvider = rolesXML.role[cbRolePicker.selectedIndex].filename.(@fileName == cbChosenFile.selectedLabel).controls.control;
So I added code to append a number to the values that populate the datafields hoping that having unique data would cure the problem. It didn't.
this is the code/function that causes the the Roles Combobox to reset but prevents the datagrid problem:
private function loadSiteInfo():void
private function loadRoles_resultsHandler(re:ResultEvent):void
rolesXML = re.result as XML;
I don't know how much info you need to assist. I can post code if needed, but I have to be careful - this is health care stuff.