hello!, sorry but i cant refresh de datagrid in this code:
I use PHP to read de data from Mysql using HttpService.  The INSERT is ok, but 
i have to reload the app to view de result in datagrid.
The event is called from the buttom "grabar" using de function "actualiza" in 
the end of this code:
The funcion "actualiza" invoke the PHP file and reload de httpservice to the 
datagrid

Thank fro all

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute" 
width="100%" height="100%"
    creationComplete="llena_grilla.send()" >

<mx:Script>
    <![CDATA[
        import mx.events.ListEvent;
        import mx.events.DataGridEvent;
        private function seleccion(event:ListEvent):void {
            var fila:Object = event.currentTarget.selectedItem;
            dni.text = fila.dni;
            nombres.text = fila.nombres;
            descripcion.text = fila.descripcion;            
        }
        
        private function limpiar():void{
            dni.text = "";
            nombres.text = "";
            descripcion.text=""
            dni.setFocus();
        }
        
        private function actualiza():void{
            inserta.send();
            llena_grilla.send();
        }
    ]]>
</mx:Script>

<!--  service call -->
<!-- Para llenar la grilla -->
<mx:HTTPService id="llena_grilla" 
url="http://localhost/flex_php_009/src/filtro.php";
      resultFormat="e4x">
</mx:HTTPService>

<!-- Para el Combo -->
<mx:HTTPService id="llena_combo" 
url="http://localhost/flex_php_009/src/myxml.php";
      resultFormat="e4x">
</mx:HTTPService>

<!-- Para la Insercion de Registros -->
<mx:HTTPService id="inserta" url="http://localhost/flex_php_009/src/inserta.php";
     method="POST"
      resultFormat="e4x">
     <mx:request>
         <dni>{dni.text}</dni>
         <nombres>{nombres.text}</nombres>
         <id>{descripcion.selectedIndex}</id>
     </mx:request>
</mx:HTTPService>

<!-- Layout -->
    <mx:Panel width="622" height="254" layout="absolute" verticalCenter="30" 
horizontalCenter="24">
        <mx:DataGrid x="10" y="10"
            dataProvider="{llena_grilla.lastResult.registro}"
            itemClick="seleccion(event)"
            change="seleccion(event)"
            id="datagrid1">
            <mx:columns>
                <mx:DataGridColumn headerText="DNI" dataField="dni"/>
                <mx:DataGridColumn headerText="NOMBRES" dataField="nombres"/>
                <mx:DataGridColumn headerText="DISTRITO" 
dataField="descripcion"/>
            </mx:columns>
        </mx:DataGrid>
        <mx:Form x="320" y="10" width="272" height="142">
            <mx:FormItem label="DNIl">
                <mx:TextInput id="dni"/>
            </mx:FormItem>
            <mx:FormItem label="NOMBRES">
                <mx:TextInput id="nombres"/>
            </mx:FormItem>
            <mx:FormItem label="DISTRITO">
                <mx:ComboBox id="descripcion"
                    creationComplete="llena_combo.send()"
                    dataProvider="{llena_combo.lastResult.registro}"
                    labelField="descripcion" width="120"></mx:ComboBox>
            </mx:FormItem>
        </mx:Form>
        <mx:HBox x="10" y="171" width="582" height="33" horizontalAlign="right">
            <mx:Button label="Nuevo" id="nuevo" click="limpiar()"/>
            <mx:Button label="Grabar" id="grabar" click="actualiza()"/>
        </mx:HBox>
    </mx:Panel>
    
</mx:Application>



____________________________________________Carlos A. Diaz AlvaradoJefe de 
Informatica & Sistemas Instituto LIBERTADOR SAC
Jr. Martir Olaya 327 Chorrillos
995-262870, 4670643 Anexo [email protected]



      
____________________________________________________________________________________
¡Obtén la mejor experiencia en la web!
Descarga gratis el nuevo Internet Explorer 8. 
http://downloads.yahoo.com/ieak8/?l=e1

Reply via email to