Comunidad de diseño web y desarrollo en internet online

Problemas con flex xml y datagrid

Citar            
MensajeEscrito el 24 Abr 2009 07:58 am
Buenos dias

Queria comentaros por que soy un poco nuevo en esto y queria ver si me podiais ayudar con mi problema, concretamente lo que me sucede es que estoy intentando mostar unos datos de un php con xml a un datagrid y no consigo hacerlo. os copio el codigo para ver si me podeis ayudar

muchas gracias


un saludo

este el archivo en php

<?php

// Datos de Acesso --------------------

$bbdd_login_host = "localhost";
$bbdd_login_nombre = "pruebas";
$bbdd_login_usuario = "root";
$bbdd_login_pass = "";

// ------------------------------------



$link_login = mysql_connect($bbdd_login_host, $bbdd_login_usuario, $bbdd_login_pass) or die("Imposible conectar a servidor MySQL");
$re = mysql_query("USE $bbdd_login_nombre", $link_login) or die("No se ha podido abrir la base de datos: ".mysql_error());

$qLogin = "SELECT dni, apellidos, funcion FROM personal";
$re_login = mysql_query($qLogin, $link_login);

header("Content-Type: text/xml");
header("Cache-Control:cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
echo '<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<xml>';

while ($datosLogin = mysql_fetch_array($re_login)){

echo '<DNI>'.$datosLogin['dni'] .'</DNI>';

echo '<apellidos>'.$datosLogin['apellidos'] .'</apellidos>';


echo '<funcion>'.$datosLogin['funcion'] .'</funcion>';

};

echo '</xml>';

?>

y este es el archivo en flex

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


<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
cornerRadius="0"
xmlns="*"
layout="absolute"
frameRate="60" backgroundGradientAlphas="[0.49, 0.03]"
backgroundGradientColors="[#2724A2, #FD0000]"
themeColor="#FFFFFF" alpha="1.0">

<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
import flash.net.URLRequest;
import flash.net.URLLoader;
import mx.controls.Alert;
import mx.collections.ArrayCollection;

public var apellidos:String;
public var funcion:String;
public var xmlObj:XML;




private function CargaXML():void {
var request:URLRequest = new URLRequest(".\webamil.php");
var loader:URLLoader = new URLLoader();
loader.load(request);
var xmlStr:String = "request";
var xmlObj:XML = new XML(xmlStr);
trace(xmlObj);
}




]]>
</mx:Script>
<mx:HTTPService id="servicio" url="http://localhost/PanelClientes/webamil.php"/>

<mx:states>
<mx:State name="adduser">
<mx:RemoveChild target="{btneliminar}"/>
<mx:RemoveChild target="{btneditar}"/>
<mx:AddChild position="lastChild">
<mx:Button label="Cancelar" textAlign="center" click="currentState=''" enabled="true" labelPlacement="bottom" icon="@Embed(source='../cancelar.png')" width="111" height="62" right="48" bottom="21"/>
</mx:AddChild>
<mx:AddChild position="lastChild">
<mx:Button label="Guardar" textAlign="center" enabled="true" labelPlacement="bottom" height="62" icon="@Embed(source='../guardar_es.gif')" width="111" bottom="21" right="168"/>
</mx:AddChild>
<mx:AddChild position="lastChild">
<mx:Form id="formUser" color="#2724A2" borderStyle="solid" borderThickness="7" themeColor="#FFFFFF" borderColor="#EFF5F9" cornerRadius="20" left="145" top="209" height="306" right="72">
<mx:FormItem label="Direccion:" color="#F9F3F3" fontWeight="bold">
</mx:FormItem>
<mx:TextInput color="#060000" id="dir"/>
<mx:FormItem label="ID:" color="#F9F3F3" fontWeight="bold">
</mx:FormItem>
<mx:TextInput color="#060000" id="ide"/>
<mx:FormItem label="Contraseña:" color="#F9F3F3" fontWeight="bold" width="88" id="clave">
</mx:FormItem>
<mx:TextInput displayAsPassword="true" color="#060000" id="pass"/>
<mx:FormItem label="Nombre:" color="#F9F3F3" fontWeight="bold">
</mx:FormItem>
<mx:TextInput color="#060000" id="nom"/>
<mx:FormItem label="Dominio:" color="#F9F3F3" fontWeight="bold">
</mx:FormItem>
<mx:TextInput color="#060000" id="dom"/>
</mx:Form>
</mx:AddChild>
<mx:SetProperty target="{nuevacuenta}" name="enabled" value="false"/>
<mx:SetProperty target="{textcorreo}" name="text" value="Añadir nueva Cuenta de Correo"/>
<mx:SetProperty target="{nuevacuenta}" name="y" value="20"/>
<mx:RemoveChild target="{CuentasCorreo}"/>
<mx:SetProperty target="{textcorreo}" name="width" value="653"/>
</mx:State>
<mx:State name="editUser">
<mx:RemoveChild target="{nuevacuenta}"/>
<mx:RemoveChild target="{CuentasCorreo}"/>
<mx:AddChild position="lastChild">
<mx:Form id="formedituser" borderStyle="solid" borderColor="#F2F6F8" themeColor="#FFFFFF" cornerRadius="20" borderThickness="8" alpha="1.0" right="99.5" left="145" top="209" height="302">
<mx:FormItem label="Direccion:" color="#F9F3F3" fontWeight="bold">
</mx:FormItem>
<mx:TextInput color="#060000"/>
<mx:FormItem label="ID:" color="#F9F3F3" fontWeight="bold">
</mx:FormItem>
<mx:TextInput color="#060000"/>
<mx:FormItem label="Contraseña:" color="#F9F3F3" fontWeight="bold" width="88" id="clave0">
</mx:FormItem>
<mx:TextInput displayAsPassword="true" color="#060000"/>
<mx:FormItem label="Nombre:" color="#F9F3F3" fontWeight="bold">
</mx:FormItem>
<mx:TextInput color="#060000"/>
<mx:FormItem label="Dominio:" color="#F9F3F3" fontWeight="bold">
</mx:FormItem>
<mx:TextInput color="#060000"/>

</mx:Form>
</mx:AddChild>
<mx:SetEventHandler target="{btneliminar}" name="click"/>
<mx:SetProperty target="{textcorreo}" name="text" value="Editar Cuenta de Correo"/>
<mx:SetEventHandler target="{btneditar}" name="click" handler="currentState='editUser'"/>
<mx:AddChild position="lastChild">
<mx:Button label="Atras" labelPlacement="bottom" width="111" id="btnatras" enabled="true" height="81" icon="@Embed(source='../atras.png')" bottom="21" right="287" click="currentState=&quot;&quot;"/>
</mx:AddChild>

<mx:SetProperty target="{btneditar}" name="enabled" value="false"/>

</mx:State>

</mx:states>
<mx:Image height="82" source="../Syscad SL.gif" left="10" top="10" right="373"/>
<mx:Button label="Eliminar" labelPlacement="bottom" width="111" id="btneliminar" bottom="21" right="48" enabled="true" height="81" icon="@Embed(source='../borrar.png')"/>
<mx:Button label="Editar" labelPlacement="bottom" width="111" id="btneditar" right="168" bottom="21" enabled="true" icon="@Embed(source='../ico_editar.gif')" height="81" click="this.currentState='editUser'"/>
<mx:Button y="15" label="Nueva cuenta" id="nuevacuenta" labelPlacement="bottom" enabled="true" right="31" height="122" icon="@Embed(source='../icono_usuarios.gif')" click="currentState='adduser'">
</mx:Button>

<mx:Label text="Cuentas de Correo" width="329" height="46" fontFamily="Arial" fontSize="25" fontWeight="bold" color="#E6EFF1" id="textcorreo" top="129" textAlign="center" right="230"/>
<mx:DataGrid id="CuentasCorreo" top="201" bottom="122" right="110" left="110" dataProvider="{xmlObj}" editable="false" enabled="true">
<mx:columns>
<mx:DataGridColumn headerText="Direccion" dataField="a"/>
<mx:DataGridColumn headerText="Nombre" dataField="funcion"/>
<mx:DataGridColumn headerText="Dominio" dataField="dni"/>
<mx:DataGridColumn headerText="Activo" dataField="act"/>
<mx:DataGridColumn headerText="Accion" dataField="accion"/>
</mx:columns>
</mx:DataGrid>

</mx:Application>

lo he probado todo de todas las menras y todavia no he podido hacer que me muestre los datos...



muchas gracias

Por flexoskar

38 de clabLevel



 

Madrid

msie7
Citar            
MensajeEscrito el 24 Abr 2009 09:46 am
Buenos dias

Queria comentaros por que soy un poco nuevo en esto y queria ver si me podiais ayudar con mi problema, concretamente lo que me sucede es que estoy intentando mostar unos datos de un php con xml a un datagrid y no consigo hacerlo. os copio el codigo para ver si me podeis ayudar

muchas gracias


un saludo

este el archivo en php

Código :


<?php

// Datos de Acesso --------------------

$bbdd_login_host       = "localhost";
$bbdd_login_nombre       = "pruebas";
$bbdd_login_usuario    = "root";
$bbdd_login_pass       = "";

// ------------------------------------



$link_login = mysql_connect($bbdd_login_host, $bbdd_login_usuario, $bbdd_login_pass) or die("Imposible conectar a servidor MySQL");
$re = mysql_query("USE $bbdd_login_nombre", $link_login) or die("No se ha podido abrir la base de datos: ".mysql_error());

$qLogin = "SELECT dni, apellidos, funcion FROM personal";
$re_login = mysql_query($qLogin, $link_login);

header("Content-Type: text/xml");
header("Cache-Control:cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
echo '<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<xml>';      

while ($datosLogin = mysql_fetch_array($re_login)){

   echo '<DNI>'.$datosLogin['dni'] .'</DNI>';
   
   echo '<apellidos>'.$datosLogin['apellidos'] .'</apellidos>';
   
   
   echo '<funcion>'.$datosLogin['funcion'] .'</funcion>';

};
   
echo '</xml>';   

?> 

[quote="flexoskar"]

y este es el archivo en flex


Código :

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


<mx:Application 
   xmlns:mx="http://www.adobe.com/2006/mxml" 
   cornerRadius="0" 
   xmlns="*"
   layout="absolute"
   frameRate="60" backgroundGradientAlphas="[0.49, 0.03]"
   backgroundGradientColors="[#2724A2, #FD0000]" 
   themeColor="#FFFFFF" alpha="1.0">

<mx:Script>
   <![CDATA[
      import mx.managers.PopUpManager;
         import flash.net.URLRequest;
         import flash.net.URLLoader;   
         import mx.controls.Alert;   
          import mx.collections.ArrayCollection;
         
         public var apellidos:String;
         public var funcion:String; 
         public var xmlObj:XML;
         
         
      

            private function CargaXML():void {
            var request:URLRequest = new URLRequest(".\webamil.php");
            var loader:URLLoader = new URLLoader();
            loader.load(request);      
            var xmlStr:String = "request";
            var xmlObj:XML = new XML(xmlStr);
            trace(xmlObj);            
            }

            
   
      
   ]]>
</mx:Script>
<mx:HTTPService id="servicio" url="http://localhost/PanelClientes/webamil.php"/>

   <mx:states>
      <mx:State name="adduser">
         <mx:RemoveChild target="{btneliminar}"/>
         <mx:RemoveChild target="{btneditar}"/>
         <mx:AddChild position="lastChild">
            <mx:Button label="Cancelar" textAlign="center" click="currentState=''" enabled="true" labelPlacement="bottom" icon="@Embed(source='../cancelar.png')" width="111" height="62" right="48" bottom="21"/>
         </mx:AddChild>
         <mx:AddChild position="lastChild">
            <mx:Button label="Guardar" textAlign="center" enabled="true" labelPlacement="bottom"  height="62" icon="@Embed(source='../guardar_es.gif')" width="111" bottom="21" right="168"/>
         </mx:AddChild>
         <mx:AddChild position="lastChild">
            <mx:Form id="formUser" color="#2724A2" borderStyle="solid" borderThickness="7" themeColor="#FFFFFF" borderColor="#EFF5F9" cornerRadius="20" left="145" top="209" height="306" right="72">
            <mx:FormItem label="Direccion:" color="#F9F3F3" fontWeight="bold">
            </mx:FormItem>
            <mx:TextInput color="#060000" id="dir"/>
            <mx:FormItem label="ID:" color="#F9F3F3" fontWeight="bold">
            </mx:FormItem>
            <mx:TextInput color="#060000" id="ide"/>
            <mx:FormItem label="Contraseña:" color="#F9F3F3" fontWeight="bold" width="88" id="clave">
            </mx:FormItem>
            <mx:TextInput displayAsPassword="true" color="#060000" id="pass"/>
            <mx:FormItem label="Nombre:" color="#F9F3F3" fontWeight="bold">
            </mx:FormItem>
            <mx:TextInput color="#060000" id="nom"/>
            <mx:FormItem label="Dominio:" color="#F9F3F3" fontWeight="bold">
            </mx:FormItem>
            <mx:TextInput color="#060000" id="dom"/>            
            </mx:Form>
         </mx:AddChild>
         <mx:SetProperty target="{nuevacuenta}" name="enabled" value="false"/>
         <mx:SetProperty target="{textcorreo}" name="text" value="Añadir nueva Cuenta de Correo"/>
         <mx:SetProperty target="{nuevacuenta}" name="y" value="20"/>
         <mx:RemoveChild target="{CuentasCorreo}"/>
         <mx:SetProperty target="{textcorreo}" name="width" value="653"/>
      </mx:State>
      <mx:State name="editUser">
         <mx:RemoveChild target="{nuevacuenta}"/>
         <mx:RemoveChild target="{CuentasCorreo}"/>
         <mx:AddChild position="lastChild">
            <mx:Form id="formedituser" borderStyle="solid" borderColor="#F2F6F8" themeColor="#FFFFFF" cornerRadius="20" borderThickness="8" alpha="1.0" right="99.5" left="145" top="209" height="302">
            <mx:FormItem label="Direccion:" color="#F9F3F3" fontWeight="bold">
            </mx:FormItem>
            <mx:TextInput color="#060000"/>
            <mx:FormItem label="ID:" color="#F9F3F3" fontWeight="bold">
            </mx:FormItem>
            <mx:TextInput color="#060000"/>
            <mx:FormItem label="Contraseña:" color="#F9F3F3" fontWeight="bold" width="88" id="clave0">
            </mx:FormItem>
            <mx:TextInput displayAsPassword="true" color="#060000"/>
            <mx:FormItem label="Nombre:" color="#F9F3F3" fontWeight="bold">
            </mx:FormItem>
            <mx:TextInput color="#060000"/>
            <mx:FormItem label="Dominio:" color="#F9F3F3" fontWeight="bold">
            </mx:FormItem>
            <mx:TextInput color="#060000"/>
            
            </mx:Form>
         </mx:AddChild>
         <mx:SetEventHandler target="{btneliminar}" name="click"/>
         <mx:SetProperty target="{textcorreo}" name="text" value="Editar Cuenta de Correo"/>
         <mx:SetEventHandler target="{btneditar}" name="click" handler="currentState='editUser'"/>
         <mx:AddChild position="lastChild">
            <mx:Button label="Atras" labelPlacement="bottom" width="111" id="btnatras" enabled="true" height="81" icon="@Embed(source='../atras.png')" bottom="21" right="287" click="currentState=&quot;&quot;"/>
         </mx:AddChild>
         
         <mx:SetProperty target="{btneditar}" name="enabled" value="false"/>
         
      </mx:State>
      
   </mx:states>
   <mx:Image height="82" source="../Syscad SL.gif" left="10" top="10" right="373"/>
   <mx:Button label="Eliminar" labelPlacement="bottom" width="111" id="btneliminar" bottom="21" right="48" enabled="true" height="81" icon="@Embed(source='../borrar.png')"/>
   <mx:Button label="Editar" labelPlacement="bottom" width="111" id="btneditar" right="168" bottom="21" enabled="true" icon="@Embed(source='../ico_editar.gif')" height="81" click="this.currentState='editUser'"/>
   <mx:Button y="15" label="Nueva cuenta" id="nuevacuenta" labelPlacement="bottom" enabled="true" right="31" height="122" icon="@Embed(source='../icono_usuarios.gif')" click="currentState='adduser'">
   </mx:Button>
   
   <mx:Label text="Cuentas de Correo" width="329" height="46" fontFamily="Arial" fontSize="25" fontWeight="bold" color="#E6EFF1" id="textcorreo" top="129" textAlign="center" right="230"/>
      <mx:DataGrid id="CuentasCorreo" top="201" bottom="122" right="110" left="110" dataProvider="{xmlObj}" editable="false" enabled="true">
      <mx:columns>
         <mx:DataGridColumn headerText="Direccion" dataField="a"/>
         <mx:DataGridColumn headerText="Nombre" dataField="funcion"/>
         <mx:DataGridColumn headerText="Dominio" dataField="dni"/>
         <mx:DataGridColumn headerText="Activo" dataField="act"/>
         <mx:DataGridColumn headerText="Accion" dataField="accion"/>                  
      </mx:columns>
   </mx:DataGrid>   

</mx:Application>

flexoskar escribió:



lo he probado todo de todas las menras y todavia no he podido hacer que me muestre los datos...



muchas gracias

Por flexoskar

38 de clabLevel



 

Madrid

msie7
Citar            
MensajeEscrito el 24 Abr 2009 05:03 pm

Por xcom

Claber

530 de clabLevel



 

firefox
Citar            
MensajeEscrito el 27 Abr 2009 07:56 am
no me deja de momento ver la url, lo intentare mas tarde.gracias de antemano y ya os comentare ;)

Por flexoskar

38 de clabLevel



 

Madrid

msie7
Citar            
MensajeEscrito el 27 Abr 2009 09:20 am
si fuera posible facilitarme cualquier otra respuesta os lo agradeceria bastante debido a que me corre un poco de prisa solucionar el problema.

gracias

Por flexoskar

38 de clabLevel



 

Madrid

msie7
Citar            
MensajeEscrito el 27 Abr 2009 03:05 pm
he estado consultando en enlace facilitado y no es lo que busco yo busco que desde el php donde realizo una consulta a una base de datos la recorro con un bucle y muestro un resultado en xml, entonces yo lo que quiero es que desde el datagrid llamar a ese xml y me muestre todos los datos que yo he seleccionado previamente en el php, no se si mas o menos sabeis lo que os digo?


muchas gracias

Por flexoskar

38 de clabLevel



 

Madrid

msie7
Citar            
MensajeEscrito el 29 Abr 2009 11:06 am
me podeis echar un cable? sigo totalmente perdido..por favor es muy urgente!

gracias

Por flexoskar

38 de clabLevel



 

Madrid

msie7
Citar            
MensajeEscrito el 30 Abr 2009 04:29 pm
ya esta solucionado!!! gracias por todo a todos :D

un saludo y ya el lunes os pongo otra dudilla que tnego muchas gracias

:P

Por flexoskar

38 de clabLevel



 

Madrid

msie7

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.