Search Results

Search found 119 results on 5 pages for 'arraycollection'.

Page 1/5 | 1 2 3 4 5  | Next Page >

  • Doubt in action script for Flex: getting unique elements from an ArrayCollection

    - by Nirmal Singh Raja Reegan
    Hi, I have an ArrayCollection as mentioned below. private var initDG:ArrayCollection = new ArrayCollection([ {fact: "Order #2314", appName: "AA"}, {fact: "Order #2315", appName: "BB"} {fact: "Order #2316", appName: "BB"} ... {fact: "Order #2320", appName: "CC"} {fact: "Order #2321", appName: "CC"} ]); I want to populate a ComboBox with UNIQUE VALUES of "appName" field from the ArrayCollection initDG. <mx:ComboBox id="appCombo" dataProvider="{initDG}" labelField="appName"/> One method I could think is to loop through the Array objects and for each object check and push unique appName entries into another Array. Is there any better solution available?

    Read the article

  • How to merge two php Doctrine 2 ArrayCollection()

    - by Throoze
    Is there any convenience method that allows me to concatenate two Doctrine ArrayCollection()? something like: $collection1 = new ArrayCollection(); $collection2 = new ArrayCollection(); $collection1->add($obj1); $collection1->add($obj2); $collection1->add($obj3); $collection2->add($obj4); $collection2->add($obj5); $collection2->add($obj6); $collection1->concat($collection2); // $collection1 now contains {$obj1, $obj2, $obj3, $obj4, $obj5, $obj6 } I just want to know if I can save me iterating over the 2nd collection and adding each element one by one to the 1st collection. Thanks!

    Read the article

  • Doctrine2 ArrayCollection

    - by boosis
    Ok, I have a User entity as follows <?php class User { /** * @var integer * @Id * @Column(type="integer") * @GeneratedValue */ protected $id; /** * @var \Application\Entity\Url[] * @OneToMany(targetEntity="Url", mappedBy="user", cascade={"persist", "remove"}) */ protected $urls; public function __construct() { $this->urls = new \Doctrine\Common\Collections\ArrayCollection(); } public function addUrl($url) { // This is where I have a problem } } Now, what I want to do is check if the User has already the $url in the $urls ArrayCollection before persisting the $url. Now some of the examples I found says we should do something like if (!$this->getUrls()->contains($url)) { // add url } but this doesn't work as this compares the element values. As the $url doesn't have id value yet, this will always fail and $url will be dublicated. So I'd really appreciate if someone could explain how I can add an element to the ArrayCollection without persisting it and avoiding the duplication? Edit I have managed to achive this via $p = function ($key, $element) use ($url) { if ($element->getUrlHash() == $url->getUrlHash()) { return true; } else { return false; } }; But doesn't this still load all urls and then performs the check? I don't think this is efficient as there might be thousands of urls per user.

    Read the article

  • ArrayCollection loop through for matching items

    - by charlie
    Hi I hope someone can help me..... i am trying to build a dynamic form for a questionnaire module. Building on some previous posts I am using the process similar to that in question "http://stackoverflow.com/questions/629021/how-to-generate-a-formmxform-dynamically-in-flex" i have managed to prove out the fact of extending the XML to include a calendar, combobox etc. my problem is that now need to get the data from an ArrayCollection rather than from an xml file. I am looking to loop through the AC and where type = "text" render a textinput field, where a type ="calendar" render a Calendar etc etc. my code so far just looking at a textinput field (and sorry for all the comments included ;) is:- [Bindable] public var AC:ArrayCollection = new ArrayCollection( [ {type:'text', direction:'horizontal', tooltip:'test tooltip', label:'my textbox label', id:'1'}, {type:'text', direction:'horizontal', tooltip:'another tooltip', label:'another label', id:'2'} ]); private function init():void { var form:Form = new Form(); for each(var elements:XML in AC) { switch( [email protected]()) { case "text": var fi:FormItem = new FormItem(); // fi.toolTip = elements.tooltip.toString(); // fi.required = getglobalprofile.required.toString(); // fi.direction = getglobalprofileb[i].@direction; var li:Label = new Label(); // li.text = getglobalprofileb[i].@label; // li.width = 100; var ti:TextInput = new TextInput(); ti.text = "test"; ti.width = 200; form.addChild(fi); fi.addChild(li); fi.addChild(ti); // break; } } this.addChild( form); } ]] <mx:Form id="form" name="form"> </mx:Form> if you are interested in the working xml version (rendering only) let me know and i will post this as well

    Read the article

  • Flex - Typed ArrayCollection as Horizontallist's dataprovider

    - by BS_C3
    Hi community! I have an ArrayCollection of objects. I'm passing this array to a horizontallist as a dataprovider and I'm using a custom itemRenderer. When executing the application, the horizontallist is displaying [object CustomClass][object CustomClass][object CustomClass][object CustomClass] I've tried casting each object in the itemrenderer as following: <mx:Label text="{(data as CustomClass).label1}"/> But it's not working... Thanks for any help you can provide. Regards, BS_C3 Edit - 09 March 2010 Let's go for some more code =) <?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Component id="Item"> <mx:VBox width="180"> <mx:HBox width="100%"> <mx:Spacer width="100%"/> <mx:Button label="x"/> </mx:HBox> <mx:Image id="thumbnail"/> <mx:Label width="100%" horizontalCenter="0" text="Collection"/> <mx:HBox width="100%"> <mx:Label width="100" text="GIA"/> <mx:Label text="{data.charg_st}"/> </mx:HBox> <mx:HBox width="100%"> <mx:Label width="100" text="Finger Size"/> <mx:Label text="xxxxxx"/> </mx:HBox> <mx:HBox width="100%"> <mx:Label width="100" text="Carat"/> <mx:Label text="{data.carats}"/> </mx:HBox> <mx:HBox width="100%"> <mx:Label width="100" text="Color"/> <mx:Label text="{data.color}"/> </mx:HBox> <mx:HBox width="100%"> <mx:Label width="100" text="Clarity"/> <mx:Label text="{data.clarity}"/> </mx:HBox> <mx:HBox width="100%"> <mx:Label width="100" text="Shop"/> <mx:Label text="{data.lgort_fp}"/> </mx:HBox> <mx:HBox width="100%"> <mx:Label width="100" text="Resizing"/> <mx:Label text="{data.resizing}"/> </mx:HBox> <mx:HBox width="100%"> <mx:Label width="100" text="Price Excl. VAT"/> <mx:Label text="{data.net_price_fp}"/> </mx:HBox> </mx:VBox> </mx:Component> <mx:HorizontalList dataProvider="{GlobalData.instance.tray}" columnCount="4" rowCount="1" horizontalScrollPolicy="off" itemRenderer="{Item}" /> </mx:Canvas> FYI, the horizonalList dataprovider is an ArrayCollection of objects. Now, the horizontallist is displaying empty items... with the correct width... The arraycollection is not empty (I'm using an alert on the click event on an item, and I do retrieve the expected data). Hope this will help _< Regards, BS_C3

    Read the article

  • ArrayCollection error in Flex does not accept single XML nodes - alternatives?

    - by Rees
    hello, i get this error when i retrieve an XML that only has 1 node (no repeating nodes) and i try to store in an ArrayCollection. -When I have MORE than 1 "name" nodes...i do NOT get an error. TypeError: Error #1034: Type Coercion failed: cannot convert "XXXXXX" to mx.collections.ArrayCollection. this error occurs as the line of code: myList= e.result.list.name; Why can't ArrayCollection work with a single node? I'm using this ArrayCollection as a dataprovider for a Component -is there an alternative I can use that will take BOTH single and repeating nodes as well as work as a dataprovider? Thanks in advance! code: [Bindable] private var myList:ArrayCollection= new ArrayCollection(); private function getList(e:Event):void{ var getStudyLoungesService:HTTPService = new HTTPService(); getStuffService.url = "website.com/asdf.php"; getStuffService.addEventListener(ResultEvent.RESULT, onGetList); getStuffService.send(); } private function onGetList(e:ResultEvent):void{ myList= e.result.list.name; }

    Read the article

  • to change xml data to ArrayCollection

    - by krishna
    I have xml file with data as below and i want to convert this into Flex ArrayCollection including the id and name of the tags. I am using httpService to get the file. data.xml <data> <result month="Jan" value="0.666"> <info id="jan01Display" name="jhon" age="20" /> <info id="jan02Display" name="adams" age="24" /> <info id="jan03Display" name="prasad" age="27" /> </result> </data>

    Read the article

  • binding to arraycollection does not work

    - by ron
    Hi, I am using flex SDK 3.5. I have model.as and in it i have an ArrayCollection (name it arr_mod) which is Bindable. From my mxml i link to this arr_mod in two ways: 1) in DataGrid i set dataprovider={arr_mode} ... 2) in Button i add new item to the arr_mod this way: 3) in textBox i want to add mx:TextBox text="{mySpecialCounterFunc(arr_mod)}" note that in the Script of mxml arr_mod is Bindable as well as in the class definition in model.as The problem is, that when clicking on button, mySpecialCounterFunc is not called! it should be called, since i use {} and this should listen to changes in arr_mod (a change that was made in the button should cause a new item to be added.. and than the listener to respond). While The DataGrid is updated correctly! Why??

    Read the article

  • Flex: Problem with CollectionEvent on ArrayCollection

    - by dasnervtdoch
    Hi there, got a reference to an arrayCollection and add event listener like this: collection.addEventListener(CollectionEvent.COLLECTION_CHANGE, onCollectionChange); that´s fine. Now some other component does have the same reference and is adding items to and removing items from that collection. Each time the handler is called: private function onProjectPersonsChange(event:Event):void { if (event.kind == CollectionEventKind.ADD) { //do something } else if (event.kind == CollectionEventKind.REMOVE) { //do something //here is the problem: event.items.length = 0 } else { trace('CollectionEvent: kind not handled!'); } } Does somebody know why the removed item is not in 'items'? Thanks in advance!

    Read the article

  • ArrayCollection versus Vector Objects in FLEX

    - by Vetsin
    Can anyone tell me the applicable differences between an ArrayCollection and a Vector in flex? I'm unsure if I should be using one over the other. I saw that Vector is type safe and that makes me feel better, but are there disadvantages? public var ac:ArrayCollection = new ArrayCollection(); versus public var vec:Vector.<String> = new Vector.<String>(); Thanks.

    Read the article

  • what dataprovider in flex (aside from ArrayCollection) will work for single, non-repeating XML nodes

    - by Rees
    hello, i asked this question before but haven't been able to get an answer.. i get the following error when i retrieve an XML that only has 1 node (no repeating nodes) from a PHP page and i try to store in an ArrayCollection. -When I have MORE than 1 "name" nodes...i do NOT get an error. TypeError: Error #1034: Type Coercion failed: cannot convert "XXXXXX" to mx.collections.ArrayCollection. this error occurs as the line of code: myList= e.result.list.name; I'm using this ArrayCollection as a dataprovider for a Component -is there an alternative I can use that will take BOTH single and repeating nodes as well as work as a dataprovider? Thanks in advance! code: [Bindable] private var myList:ArrayCollection= new ArrayCollection(); private function getList(e:Event):void{ var getStudyLoungesService:HTTPService = new HTTPService(); getStuffService.url = "website.com/asdf.php"; getStuffService.addEventListener(ResultEvent.RESULT, onGetList); getStuffService.send(); } private function onGetList(e:ResultEvent):void{ myList= e.result.list.name; }

    Read the article

  • Populate Tree using data from ArrayCollection

    - by jtorrance
    Let's say I had an ArrayCollection like this: public var ac:ArrayCollection= new ArrayCollection([ {item:"dog", group:"Animal"}, {item:"orange", group:"Fruits"}, {item:"cat", group:"Animal"}, {item:"apple", group:"Fruits"} ]); How would I create a Tree component in Flex 3 that uses the groups as nodes, with the appropriate items listed under each node?

    Read the article

  • Flex - Search in ArrayCollection by part of the word

    - by Sergei
    For example i have an ArrayCollection, and i want to find person with telephone begines with "944" how can i do this? <mx:ArrayCollection id="arrColl" > <mx:source> <mx:Array> <mx:Object telephone="944768" subscriber="Smith P.T."/> <mx:Object telephone="944999" subscriber="Peterson Q.T."/> </mx:Array> </mx:source> </mx:ArrayCollection>

    Read the article

  • ActionScript/Flex ArrayCollection of Number objects to Java Collection<Long> using BlazeDS

    - by Justin
    Hello, I am using Flex 3 and make a call through a RemoteObject to a Java 1.6 method and exposed with BlazeDS and Spring 2.5.5 Integration over a SecureAMFChannel. The ActionScript is as follows (this code is an example of the real thing which is on a separate dev network); import com.adobe.cairngorm.business.ServiceLocator; import mx.collections.ArrayCollection; import mx.rpc.remoting.RemoteObject; import mx.rpc.IResponder; public class MyClass implements IResponder { private var service:RemoteObject = ServiceLocator.getInstance().getRemoteOjbect("mySerivce"); public MyClass() { [ArrayElementType("Number")] private var myArray:ArrayCollection; var id1:Number = 1; var id2:Number = 2; var id3:Number = 3; myArray = new ArrayCollection([id1, id2, id3]); getData(myArray); } public function getData(myArrayParam:ArrayCollection):void { var token:AsyncToken = service.getData(myArrayParam); token.addResponder(this.responder); //Assume responder implementation method exists and works } } This will make a call, once created to the service Java class which is exposed through BlazeDS (assume the mechanics work because they do for all other calls not involving Collection parameters). My Java service class looks like this; public class MySerivce { public Collection<DataObjectPOJO> getData(Collection<Long> myArrayParam) { //The following line is never executed and throws an exception for (Long l : myArrayParam) { System.out.println(l); } } } The exception that is thrown is a ClassCastException saying that a java.lang.Integer cannot be cast to a java.lang.Long. I worked around this issue by looping through the collection using Object instead, checking to see if it is an Integer, cast it to one, then do a .longValue() on it then add it to a temp ArraList. Yuk. The big problem is my application is supposed to handle records in the billions from a DB and the id will overflow the 2.147 billion limit of an integer. I would love to have BlazeDS or the JavaAdapter in it, translate the ActionScript Number to a Long as specified in the method. I hate that even though I use the generic the underlying element type of the collection is an Integer. If this was straight Java, it wouldn't compile. Any ideas are appreciated. Solutions are even better! :)

    Read the article

  • Why is the uid-getter/setter called (ArrayCollection)?

    - by cowabunga1984
    Hi all, if wrote the following code and do not understand why the trace returns "false": function (with trace): import mx.controls.Alert; import mx.collections.ArrayCollection; public function runTest():void { var unique1:MyUniqueObject = new MyUniqueObject(); unique1.id = 1; var unique2:MyUniqueObject = new MyUniqueObject(); unique2.id = 2; var sameUniqueAsUnique1:MyUniqueObject = new MyUniqueObject(); sameUniqueAsUnique1.id = 1; var collection:ArrayCollection = new ArrayCollection(); collection.addItem(unique1); collection.addItem(unique2); trace(collection.contains(sameUniqueAsUnique1)); } MyUniqueObject-Class: package { import mx.core.IUID; [Bindable] public class MyUniqueObject implements IUID { public var id:int; public function get uid():String { return "MyUniqueObject." + id; } public function set uid(uid:String):void { //nothing to do here... } } } Any Ideas? Cowabunga!

    Read the article

  • Flex Arraycollection filter

    - by Prashant
    Hello all I am working in Flex. I have an arraycollection which is used to fill a tilelist with images. I am using filter method of arraycollection to filter out certain images from tilelist based on a selected value from combobox. The issue is that when the images are filtered out they just vanish suddenly. But I want to give some effect to them when they are filtered out, say slow fade effect or zoom effect. I tried removedEffect, hideEffect etc. but in vain. Can anyone please help me out. thanks.

    Read the article

  • Get object from arraycollection

    - by Nll
    I have a problem about to get an object from arraycollection of objects with Id,so I do : protected $_rootObject; public function __construct(myClasse $rootObject) { $this->_rootObject= $rootObject; } public function getObjectById($id) { $value = null; foreach($this->_rootObject as $root) { if ($id == $root->getId()) { $value = $root; break; } } return $value; } Then the function return "NULL" so it's dosn't work...

    Read the article

  • Populating DataGrid with SQLResult Air Flex

    - by Deyon
    I been beating my self up all day on this...I'm about to call it quits and get some Chinese food -=\ I'm selecting data from a local SQL DB. [Bindable] public var ac:ArrayCollection; public function select():void { statement.sqlConnection=conn; statement.text="SELECT * FROM PROJECT"; statement.execute(); var res : SQLResult = statement.getResult(); ac = new ArrayCollection(res.data); //So this traces out [Object][object] So it works trace(ac); } If I do var myObj:Object=res.data[0]; I can trace myObj and view the data. But I don't know how to insert the data into a datagrid. mygrid.dataProvider=ac; dose not work. I'm using Flash Builder 4 Help please....

    Read the article

1 2 3 4 5  | Next Page >