Hi All,
I have a datagrid where I am displaying some records.. there is default property when I click on datagrid we can get the information about that selected record.. it is fine.. If I am using my keyboard up and down arrow keys I want to get that perticular highlighted record from the datagrid. when I use up and arrokeys to rolling rows up and down ... I want get that record information .. Please help me on this..
Thanks
Ram
<?xml version="1.0" encoding="utf-8"?>
<!--
Project:
File: sample.mxml
Date: May 9, 2011
Author: Sanka Senavirathna-Administrator
-->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
[Bindable]
protected function datagrid1_keyUpHandler(event:KeyboardEvent):void
]]>
you can write a if condition to check key code.
//I dont know keycode is 38 or something
if(event.keyCode.toString()=='38' || event.keyCode==Keyboard.UP)
{
//your business logic
//launchSearchGrid();
}
Try this
protected function datagrid1_keyUpHandler(event:KeyboardEvent):void
{
if(event.keyCode==Keyboard.DOWN || event.keyCode==Keyboard.UP)
{
Alert.show("index :"+event.target.selectedIndex+"\n"+"Description :"+event.target.selectedItem.des);
}
}
North America
Europe, Middle East and Africa
Asia Pacific