Re: [flexcoders] Flex dataservices paging question
Ward Loockx schreef: Hello, I'm trying to use paging on my resultset retrieved from livecycle 2.6. In my resulthandler I only get 1result in my arraycollection(but the pagesize is set to 10!) and the count of the arraycollection 3500 (so in total 3500 results). When I try to loop over the array (he should automaticly retrieve more items -> said in documentation), I get *Error: Item requested is not available. A request for the item is now pending. * I've been googling and saw that it was a bug toward 2.4 of livecycle but running 2.6... And why am I just retrieving one result instead of 10(my specified page size)? Here is some extra code The looping in teh resulthandler * private function searchResult(evt:ResultEvent):void { for each(var obj:Webcam in foundCams) { trace("-->"+obj); } } *and the initializing of the data service object * searchService = new DataService("search"); var myrtmp:RTMPChannel = new RTMPChannel("my-rtmp", "rtmp://*:2038"); searchService.channelSet = new ChannelSet(); searchService.channelSet.addChannel(myrtmp); searchService.addEventListener(ResultEvent.RESULT,searchResult);* Thanks, Ward Looks like I'm trying to populate my own component and when an item isn't found it throws an ItemPendingError where I should add an responder to... I'm retrieving the search result in my search class and then use a component to show my results (later with next/previous button)... I'm calling the creation of the component when the resulthandler of the searchresult is called. I give my arraycollection as parameter to the component to create the results. But how can I change my code that the component can handle the errors when an item isn't found and continues populating?? Can somebody give some examples how this is done? Looks like the datagrid component can handle it by itself, how should I build in that support in my component? Thanks!
RE: [flexcoders] Flex dataservices: fill vs asynctoken
Asynchronous methods like fill() return an AsyncToken instance which you can use to add custom data to it (i.e. mark that ypu invoked a fill operation). In the result handling function the AsyncToken is available again, so you can add additional logic to your result handler, e.g. private function resultHandler(event:ResultEvent):void { switch (event.token.kind) { case "fill": ... case "delete": ... } } AsyncToken is a dynamic class so you can add whatever properties you like. Another use case of AsyncToken is to add responders to it - this allows you to dynamically setup result/fault handling functions: var token:AsyncToken = ds.fill(collection); token.addResponder(new ItemResponder(resultFunction, faultFunction, "fill")); and then private function resultFunction(result:Object, token:Object):void { // result usually is of type ResultEvent, // token is the third parameter passed to the ItemResponder constructor if (result is ResultEvent) { ... } } private function faultFunction(result:Object, token:Object):void { // result usually is of type FaultEvent, // token is the third parameter passed to the ItemResponder constructor if (result is FaultEvent) { ... } } Dirk. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Jonas WindeySent: Wednesday, August 09, 2006 11:30 AMTo: flexcoders@yahoogroups.comSubject: [flexcoders] Flex dataservices: fill vs asynctoken Hi, I’m new to flex dataservices (using WebORB), and I like to know what’s the difference between: ds = new DataService("contact"); ds.fill(contacts); and ds = new DataService("contact"); var token:AsyncToken = AsyncToken(ds.fill(contacts)); token.kind = "fill"; Thanks! Jonas Jonas Windey Web Developer T. +32 3 216 86 47 Pixco Interactive Division T. +32 3 216 86 40 F. +32 3 216 86 49 http://www.pixco.com __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
RE: [flexcoders] Flex dataservices:
Mike, The fact that the error said the send failed means that perhaps the RTMP channel isn't running... so I'm guessing something went wrong on starting the web application. Most likely the configuration was invalid. Can you look at the server startup output (perhaps in the console window itself or in the web application logs... depending on how you launched Tomcat) for an indication as to whether there were such errors, and, hopefully, a clue as to what is wrong with the config? Pete From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mike_Robinson_98Sent: Wednesday, June 21, 2006 2:35 PMTo: flexcoders@yahoogroups.comSubject: [flexcoders] Flex dataservices: I have read some of the posts on issues similar to this one.Especially the Hank Williams and Peter Farland exchange. However, thisproblem is different enough that their posts did not help.I am trying to adapt the samples examples to work with an app I amdeveloping. (BTW, all the samples work on my Tomcat test serverrunning on Windows.)The issues I have is a failure when I try to a fill on a DataService.I've attempted to simplify the configuration files but I must haveleft something out. Anyone who has some experience in this area mayeasily spot my mistake but I have tried all the changes I can think ofwithout any change in the result.Here are the gory details:// This is the script that creates the data service and tries topopulate the orders arraycollection.// Here is the AS class that acts as the DTO// **package com.othenos.metalsmith.order{import mx.data.IManaged;import mx.data.utils.Managed;import mx.core.MXMLObjectAdapter;[Managed][RemoteClass(alias="com.othenos.metalsmith.order.OrderRow")]public class OrderRow{public var orderID:int;public var orderDate:Date;public var orderAmount:Number;public var status:String = "";public var salesmanName:String = "";public var customerName:String = "";}}// Part of the Java class that is the Assembler// public class OrderAssembler {public List loadOrders(){try{return orderDao.getOrders();}catch(ModuleException me){System.out.println("Exception in getting orders - " +me.getMessage());}return null;}// The flex-enterprise-services.xml// 8"?>class="mx.messaging.channels.RTMPChannel">class="flex.messaging.endpoints.RTMPEndpoint"/>minutes>20n>>[Flex] truee>truee>trueel>trueegory>Message.*DataService.*Configurationtrue20interval>{context.root}/WEB-INF/flex/flex-enterprise-services.xmlfile>{context.root}/WEB-INF/flex/flex-data-service.xml{context.root}/WEB-INF/web.xml// The flex-data-service.xml// **8"?>class="flex.data.DataService"messageTypes="flex.data.messages.DataMessage">class="flex.data.adapters.JavaAdapter"/>/>>com.othenos.metalsmith.order.OrderAssemblerapplication/>20timeout>"500"/>"500"/>loadOrderssyncOrders// The web.xml// **8859-1"?>http://java.sun.com/xml/ns/j2ee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"version="2.4">contextConfigLocationname>/WEB-INF/conf/metalsmith-servlet.xml,/WEB-INF/conf/metalsmith-service.xml,/WEB-INF/conf/metalsmith-data.xmlflex.class.pathname>/WEB-INF/flex/hotfixes,/WEB-INF/flex/jarsorg.springframework.web.context.ContextLoaderListenerclass>actionname>org.apache.struts.action.ActionServletapplicationapplicationResourcesvalue>configname>/WEB-INF/conf/struts-config.xmlchainConfigorg/apache/struts/tiles/chain-config.xmlvalue>debugname>0value>detailname>0value>validatetruevalue>1startup>MessageBrokerServletname>MessageBrokerServletname>flex.messaging.MessageBrokerServletclass>services.configuration.filename>/WEB-INF/flex/flex-enterprise-services.xmlvalue>1startup>FlexMxmlServletMXML Processorname>Servlet wrapper for the Mxml Compileron>flex.bootstrap.BootstrapServletclass>servlet.classflex2.server.j2ee.MxmlServletwebtier.configuration.file/WEB-INF/flex/flex-webtier-config.xmlvalue>1startup>FlexSwfServletSWF Retrievername>flex.bootstrap.BootstrapServletclass>servlet.classflex2.server.j2ee.SwfServlet2startup>FlexInternalServletname>flex.bootstrap.BootstrapServletclass>servlet.classflex.server.j2ee.filemanager.FileManagerServletvalue>10on-startup>actionname>*.dopattern>MessageBrokerServletname>/messagebroker/*FlexMxmlServlet*.mxmlpattern>FlexSwfServlet*.swfpattern>FlexInternalServletname>/flex-internal/*mySQL Datasource examplen>jdbc/mysqljavax