로컬 XML 파일을 사용합니다. 웹 브라우저에서 항목을 제거하면 제거되지만 xml 파일은 변경되지 않습니다. 이게 왜 추가되는거야? 내 XML 파일은 다음과 같습니다.DataGrid에서 xml의 항목 제거, 추가 및 저장
<?xml version="1.0" encoding="utf-8" ?>
<products>
<product>
<productId>1</productId>
<categoryId>1</categoryId>
<name>Azalea</name>
<nickname>California Snow</nickname>
<instructions>Large double.</instructions>
<catalogNumber>S1</catalogNumber>
<price>15.99</price>
<photo>california_snow.jpg</photo>
</product>
<product>
<productId>2</productId>
<categoryId>1</categoryId>
<name>Tibouchina Semidecandra</name>
<instructions>Beautiful large royal.</instructions>
<catalogNumber>S2</catalogNumber>
<price>33.99</price>
<photo>princess_flower.jpg</photo>
</product>
...
나는 아래 코드를 작성하고 동시에 어떻게 추가하고 변경할 수 있습니까? 이미 당신에게
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
skinClass="skins.HPAppSkin">
<fx:Script>
<![CDATA[
protected function button1_clickHandler(event:MouseEvent):void
{
productCollection.removeItemAt(productGrid.selectedIndex);
}
]]>
</fx:Script>
<fx:Declarations>
<fx:Model id="productModel" source="data/products.xml"/>
<s:ArrayList id="productCollection"
source="{productModel.product}"/>
</fx:Declarations>
<mx:DataGrid id="productGrid" dataProvider="{productCollection}"/>
<s:Button label="Remove Item" click="button1_clickHandler(event)"
enabled="{productGrid.selectedIndex != -1}"/>
</s:Application>