Share on Google+Share on Google+

HorizontalList Control with Data Provider

Advertisement
HorizontalList control displays item in a horizontal list. It is very much similar to the List control that you have earlier used in the previous example.

HorizontalList Control with Data Provider

     

HorizontalList control displays item in a horizontal list. It is very much similar to the List control that you have earlier used in the previous example. HorizontalList control can be useful in the application where we want to arrange items in horizontal direction only but not vertically. 

In our this example we have created an array collection item which consists of the name of the employees and this item list is attached to the HorizontalList control with the dataprovider property of the HorizontalList control.

Here is the full source code of application as follows :

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
 
width="373"   height="272">
  <mx:ArrayCollection id="employeeList">
  <mx:source>
  <mx:Object label="Amit Kumar" data="1001"/>
  <mx:Object label="Sumit Kumar" data="1002"/>
  <mx:Object label="Ranjeet Kumar" data="1003"/>
  <mx:Object label="Sanjeev Kumar" data="1004"/>
  <mx:Object label="Dileep Kumar" data="1005"/>
  </mx:source> 
  </mx:ArrayCollection> 
  <mx:Panel x="10" y="10" width="353" height="252" layout="absolute" title=
 "Horizontal List with Data Provider Example">
  <mx:HorizontalList x="19" y="10" width="262" 
  height="151" 
  dataProvider="{employeeList}" 
  rowCount="1" 
  columnWidth="100"
  color="#FBFBFB" 
  borderColor="#A06565"
  backgroundColor="#FFDFA0"
  backgroundAlpha="0.75">
  
  </mx:HorizontalList>
  <mx:HorizontalList x="19" y="160" width="262" height="21" borderColor="#4B603B" 
 
columnCount="1">
  <mx:dataProvider>
  <mx:Object label="Employee List" data="List of Employee"/>
  </mx:dataProvider>
  </mx:HorizontalList>
</mx:Panel>  
</mx:Application>

Output :

Here is the output of the application as follows :

 

Watch in action :

Download Source Code

Advertisements

Advertisement

Posted on: November 16, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: HorizontalList Control with Data Provider  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0