Monday, March 15, 2010

Flex Datagrid to ComboBox

I'm using my combobox inside a custom panel where I display combos upside their related datagrid headers in this case ServicesListPanel. Call prepareFilter function when your data you want to filter is ready. I've an e4x XML reply(ServiceList) from the webservice to display all services in a datagrid. There are duplicate entried so I remove duplicates and create a new array collection so I can set it to filter's combobox dataprovider. 

I've also added setFilter function which is called when the filter's combobox selected changes. I send the selected item of the combobox and list to apply filter to this function. After filter applied I set the resultgrid's dataprovider to filtered array collection.

channel_id and channel_name are from my e4x XML, modify them according to your needs.


//PREPARE FILTER FUNCTION
private function prepareFilter():void
{
ServicesListPanel.channelCombo.dataProvider = prepareComboBox(ServiceList.server_reply.services.service);
}

// REMOVE DUPLICATES AND RETURN ARRAY COLLECTION
private function prepareComboBox(XMLData:XMLList):ArrayCollection
{
ComboList = new ArrayCollection;
ComboList.addItem({
data:0, 
label:'All'
});
for (var i:Number=0;i
{
canAdd = true;
if(ComboList.length > 0)
{
for (var x:Number=0;x
{
if(ComboList[x].label == XMLData[i].channel_name)
{
canAdd = false;
break;
}
}
}
if(canAdd)
ComboList.addItem({
data:XMLData[i].channel_id, 
label:XMLData[i].channel_name
});
}
return ComboList;
}

//SET FILTER
private function setFilter(selectedObject:Object,XMLData:XMLList):void
{
FilteredList = new ArrayCollection;
for (var i:Number=0;i
{
if(XMLData[i].channel_name == selectedObject.label || selectedObject.data == 0)
{
FilteredList.addItem(XMLData[i]);
}
}
resultsGrid.dataProvider = FilteredList;
}

Tuesday, December 8, 2009

Unrevealed Technology

Monday night I've watched a new video my friend posted me. It was about a new computer actually a new laptop which is called rolltop, which looks amazing and gives idea what near future mobile computing will look like. As you can understand this computer is rolled and carried and when needed its unrolled. It can be used as regular laptops as half of the rolltop as screen and the other half for keyboard. You can also use it as a tablet pc and it has a electronic pen to use with. And it can also be used as a monitor or tv screen and rolltop's carrier becomes the speaker which also serves as power supply and usb connections.

To better understand if this future design may be possible in the near future, I've also found some related videos. The first one is about OLED display technology. If you don't heard about this technology yet you'll hear it so much in the coming year. By watching some OLED videos and viewing some products available today you can have more idea about it. OLED is the technology which will make rolltop like computing hardware possible.
http://www.oled-display.net/how-works-the-oled-technology
http://www.oled-display.net/what-is-amoled
http://www.oled-display.net/oled-television

An old but not much seen or hear technology is Microsoft Surface. Microsoft Surface is a surface computing platform that responds to natural hand gestures and real world objects. Think it as you use your table or desk  as a computer display, which can be used your hands which you don't need mouse or keyboard at all. Your table will also recognize devices that have wi-fi or bluetooth connection, like your mobile phone, digital camera. When you put your mobile phone on the table it will be recognized and you can have your files from the phone in no time and also can put files into your phone like, contacts, photos, map directions, etc. and email them to any of your friend. Also your friends sitting around the table can put their phone or digital camera on the table and you all can share your files or play games. The following sites have very good information about what this technology is and how it can be used and what we can expect in the coming years.
http://www.youtube.com/watch?v=Zxk_WywMTzc
http://www.microsoft.com/surface/

The last technology I've discovered is an old technology but haven't seen its ads on paper or internet much so for me its a new and a fun discovery. Its called Sonny Rolly. Its a fun mp3 player which you can have real good time while listening to music. Its probably will be loved by your friends also, its a small, moving, dancing mp3 player, looks cool, entertaining. I've a sample video link here, also you can find more by searching "sony rolly".