flex中的datagrid删除一行

//XML数据
  <?xml version="1.0" encoding="UTF-8" ?>
- <baseData>
- <record>
  <dataid>4</dataid>
  <dataName>hello1</dataName>
  </record>
- <record>
  <dataid>7</dataid>
  <dataName>aa</dataName>
  </record>
- <record>
  <dataid>20</dataid>
  <dataName>居住1</dataName>
  </record>
  </baseData>

//将XML转为XMLListCollection,因为XMLListCollection中可以直接删除一行,并更新datagrid
var dataXML: XML = BaseDataModel.getInstance().dataXML;
dataList = new XMLListCollection(dataXML.record);
baseDataGrid.dataProvider = dataList;

//删除一行,删除后会自动更新datagrid的显示
dataList.removeItemAt(baseDataGrid.selectedIndex);

你可能感兴趣的:(xml,Flex)