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]</email>
                            <active>true</active>
                        </employee>
                        <employee>
                            <name>Joanne Wall</name>
                            <phone>555</phone>
                            <email>[EMAIL PROTECTED]</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 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to