How to reload or refresh my dataGrid after deleting recored from
database. I am using asp to delete the recoreds.

But the datagrid is not refreshing. after clicking the delete button.
How to do it. I am new 2 Flex.


<?xml version="1.0" encoding="utf-8"?>


<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; xmlns="*"
layout="absolute" 
                    creationComplete="userRequest.send()">

<mx:Script>
        <![CDATA[
            private function deleteData():void {
                                userDelete.send();                              
                                                                
            }
            
            private function showData():void {
                                userRequest.send();
                                
            }                     
        ]]>
</mx:Script>        
        <mx:HTTPService id="userRequest" url="request.asp" useProxy="false" 
                             method="POST">
                <mx:request xmlns="">
                        <user_name>{username.text}</user_name>
                </mx:request>
        </mx:HTTPService>

        <mx:HTTPService id="userDelete" url="request.asp" useProxy="false" 
                             method="POST">
                <mx:request xmlns="">
                        <user_id>{dgUserRequest.selectedItem.userid}</user_id>
                </mx:request>
        </mx:HTTPService>

        <mx:Form x="22" y="10" width="493">
                <mx:HBox><mx:Label text="Username"/><mx:TextInput
id="username"/></mx:HBox>
                <mx:Button label="Submit" click="showData();"/>
                <mx:Button label="Delete" click="deleteData();"/>               
        
        </mx:Form>

        <mx:DataGrid id="dgUserRequest"
dataProvider="{userRequest.lastResult.users.user}"
                                 x="22" y="140" width="493" height="125"  >
                <mx:columns>
                        <mx:DataGridColumn headerText="User ID" 
dataField="userid"/>
                        <mx:DataGridColumn headerText="User Name" 
dataField="username"/>
                        <mx:DataGridColumn headerText="E-Mail" 
dataField="emailaddress"/>
                </mx:columns>
        </mx:DataGrid>

        <mx:TextInput id="selectedemailaddress"
text="{dgUserRequest.selectedItem.emailaddress}"
                   x="355" y="273" />

        <mx:TextInput id="selecteduserid"
text="{dgUserRequest.selectedItem.userid}"
                   x="22" y="273" />               

</mx:Application>

Reply via email to