I haven’t run your app yet but my immediate guess is that delete does not emit the events necessary for the control to update.

 

I think you will have better luck if you use an XMLListCollection with its remove methods.  I haven’t done enough of this to be able to spit out an example, sorry.

 

Tracy

 


From: [email protected] [mailto:[email protected]] On Behalf Of flxcoder
Sent: Tuesday, August 01, 2006 4:23 PM
To: [email protected]
Subject: [flexcoders] Is datagrid not bindable to the dataprovider

 

I am trying to manage my datagrid using the dataprovider, so if I
delete the nodes in the data provider (an XmlList) I expect the rows
in the datagrid to be removed too.

Is this a wrong assumption. Please see below?
===start===
<?xml version="1.0"?>
<!-- DataGrid control example. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
private function deleteAll():void{
for (var i:uint=0;i<=employees.length();i++){
delete employees[0];
}
}
private var emp:XML =
<employees>
<employee>
<name>Christina Coenraets</name>
<phone>555-219-2270</phone>
<email>[EMAIL PROTECTED]us.com</email>
<active>true</active>
</employee>
<employee>
<name>Joanne Wall</name>
<phone>555</phone>
<email>[EMAIL PROTECTED]com</email>
<active>true</active>
</employee>
</employees>;

[Bindable]
private var employees:XMLList = emp.employee;


]]>
</mx:Script>

<mx:Panel title="DataGrid Control Example" height="100%"
width="100%"
paddingTop="10" paddingLeft="10" paddingRight="10">
<mx:DataGrid id="dg" width="100%" height="100%" rowCount="5"
dataProvider="{employees}">
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="Name"/
>
<mx:DataGridColumn dataField="phone"
headerText="Phone"/>
<mx:DataGridColumn dataField="email"
headerText="Email"/>
</mx:columns>
</mx:DataGrid>
<mx:Button label="Delete" click="deleteAll()"/>
</mx:Panel>
</mx:Application>
===end===

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to