Comunidad de diseño web y desarrollo en internet online

busqueda httpservice

Citar            
MensajeEscrito el 25 Ago 2008 05:58 pm
Hola compañeros, espero me puedan ayudar, soy nuevo estos de flex y en estos momentos tengo un problema con flex. lo que quiero es hacer una busqueda y mostrar los datos en un datagrid, la idea es que en lo que vaya escribiendo me vaya apareciendo en el datagrid las opciones que estoy escribiendo. me encontre con un codigo parecido, pero mi estructura de datos es diferente y no me funciona, aca va el codio:

estructura de datos:

<?xml version="1.0" encoding="UTF-8" ?>
- <posters>
- <posting>
<id>1</id>
<emailaddress>g6g</emailaddress>
<message>g6g6</message>
<messagetopic>g6</messagetopic>
<postername>g6t6</postername>
</posting>
- <posting>
<id>2</id>
<emailaddress>g6g</emailaddress>
<message>g6g6</message>
<messagetopic>g6</messagetopic>
<postername>wreghr</postername>
</posting>
</posters>



codigo xml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="messageRequest.send()">
<mx:Script>
<![CDATA[
import mx.controls.*
private function filterFunc(item:Object):Boolean {
return item.text().match(new RegExp("^" + nameM.text, "i"));
}
]]>
</mx:Script>
<mx:XMLListCollection id="xmlListColl" source="{messageRequest.lastResult.posting}" filterFunction="filterFunc" />
<mx:HTTPService id="messageRequest" method="POST" resultFormat="e4x"
url="http://mi_maquina/myMessageBoard/messageBoardConnector.cfm">
<mx:request xmlns="">
<emailaddress>{}</emailaddress>
<message>{}</message>
<messagetopic>{}</messagetopic>
<postername>{}</postername>
</mx:request>
</mx:HTTPService>
<mx:Panel title="Datos BlackBerry" height="560" width="700"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10" x="22.95" y="9.1">
<mx:TabNavigator>
<mx:VBox label="Modificar">
<mx:VBox>
<mx:Form>
<mx:FormItem label="Poster Name:" >
<mx:TextInput id="nameM" change="{xmlListColl.refresh()}"/>
</mx:FormItem>
</mx:Form>
</mx:VBox>
<mx:Form>
<mx:DataGrid id="dgMessage" width="600"
dataProvider="{xmlListColl}" editable="true" >
<mx:columns>
<mx:DataGridColumn headerText="Poster Name"
dataField="postername" width="200"/>
<mx:DataGridColumn headerText="Email Address"
dataField="emailaddress" width="200"/>
<mx:DataGridColumn headerText="Message Topic"
dataField="messagetopic" width="200" />
</mx:columns>
</mx:DataGrid>
<mx:TextArea height="100" width="300" text="{dgMessage.selectedItem.message}"/>
<mx:Label text="Filtered: Showing {xmlListColl.length} record(s)" visible="{nameM.text.length > 0}" />
</mx:Form>
</mx:VBox>
</mx:TabNavigator>
</mx:Panel>
</mx:Application>

Por jtisnado

5 de clabLevel



Genero:Masculino  

msie7
Citar            
MensajeEscrito el 25 Ago 2008 09:05 pm
Te olvidaste de darle formato a tu código

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 26 Ago 2008 02:18 pm
Perdon no sabia.

estructura de datos:

Código :

<?xml version="1.0" encoding="UTF-8" ?> 
<posters>
  <posting>
    <id>1</id> 
    <emailaddress>g6g</emailaddress> 
    <message>g6g6</message> 
    <messagetopic>g6</messagetopic> 
    <postername>g6t6</postername> 
  </posting>
  <posting>
    <id>2</id> 
    <emailaddress>g6g</emailaddress> 
    <message>g6g6</message> 
    <messagetopic>g6</messagetopic> 
    <postername>wreghr</postername> 
  </posting>
</posters>


codigo xml:

Código :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="messageRequest.send()">
   <mx:Script>
      <![CDATA[
         import mx.controls.*      
            private function filterFunc(item:Object):Boolean {
               return item.text().match(new RegExp("^" + nameM.text, "i"));
            }             
      ]]>
   </mx:Script>      
    <mx:XMLListCollection id="xmlListColl" source="{messageRequest.lastResult.posting}" filterFunction="filterFunc" />                   
   <mx:HTTPService id="messageRequest" method="POST" resultFormat="e4x"
      url="http://mi_maquina/myMessageBoard/messageBoardConnector.cfm">
         <mx:request xmlns="">
            <emailaddress>{}</emailaddress>
            <message>{}</message>
            <messagetopic>{}</messagetopic>
            <postername>{}</postername>
         </mx:request>
   </mx:HTTPService>
   <mx:Panel title="Datos BlackBerry" height="560" width="700"
        paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10" x="22.95" y="9.1">   
      <mx:TabNavigator>               
         <mx:VBox label="Modificar">                           
            <mx:VBox>
               <mx:Form>
                  <mx:FormItem label="Poster Name:" >
                     <mx:TextInput id="nameM" change="{xmlListColl.refresh()}"/>
                  </mx:FormItem>
               </mx:Form>
            </mx:VBox>
            <mx:Form>
               <mx:DataGrid id="dgMessage" width="600"
                  dataProvider="{xmlListColl}" editable="true" >
                  <mx:columns>
                     <mx:DataGridColumn headerText="Poster Name"
                        dataField="postername" width="200"/>
                     <mx:DataGridColumn headerText="Email Address"
                        dataField="emailaddress" width="200"/>
                     <mx:DataGridColumn headerText="Message Topic"
                        dataField="messagetopic" width="200" />
                  </mx:columns>
               </mx:DataGrid>
               <mx:TextArea height="100" width="300" text="{dgMessage.selectedItem.message}"/>
                   <mx:Label text="Filtered: Showing {xmlListColl.length} record(s)" visible="{nameM.text.length > 0}" />
                </mx:Form>
            </mx:VBox>                                                
      </mx:TabNavigator>
   </mx:Panel>
</mx:Application>

Por jtisnado

5 de clabLevel



Genero:Masculino  

msie7

 

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