[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

arrayCollection Grouping for comboBox

Posted on 2011-03-14
1
Medium Priority
?
553 Views
Last Modified: 2012-08-13
How to group items in an array collection so my combobox does not repeat the duplicat items. I have don this with a datagrid but can not seem to get to work with a combobox.
0
Comment
Question by:kpjj31
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 29

Accepted Solution

by:
dgofman earned 2000 total points
ID: 35134376
You may not need to use a groupCollection,
You can use an Array filter.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" initialize="init()">
	<fx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;

			private var _original:Array = new Array(
					{label:"One", data:1},
					{label:"Two", data:2},
					{label:"Three", data:3},
					{label:"One", data:1}
			);
			
			private function init():void{
				var keys:Object = {};
				var filteredArr:Array = _original.filter(function(item:Object, idx:uint, arr:Array):Boolean {
					if (keys.hasOwnProperty(item.data)) {
						return false;
					} else {
						keys[item.data] = item;
						return true;
					}
				});
				cmb_uniq.dataProvider = new ArrayCollection(filteredArr);
			}
		]]>
	</fx:Script>
	<s:ComboBox id="cmb_uniq"/>
</s:Application>

Open in new window

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question