I have a spark datagrid on a mobile application, I set the
interactionMode="touch"
and the dataGrid scrolling is good, I got some problems adding a selectionChange eventListener to it, because scrolling the dataGrid will automatically change the selection and instead simply scrolling it, the function binded will start...
How can I prevent that?
<s:DataGrid id="lista" top="350" bottom="50" right="0" left="0"
dataProvider="{listaPdv}"
verticalScrollPolicy="auto"
rowHeight="100"
selectionColor="#b64947"
skinClass="skins.dataGridSkin"
itemRenderer="components.dataGridItemRendererText"
fontFamily="Verdana"
fontSize="30"
interactionMode="touch"
horizontalScrollPolicy="auto"
selectionChange="datagrid_select(event)">
Help... It's really annoying and I cannot scroll the datagrid...
I solved using a workaround... instead of binding the selectionChange event, I binded the mouseDown and mouseUp then check the time between the two actions and if the time is less then a defined value the selectionChange event is dispatched...
<s:DataGrid id="grigliaData"
sortableColumns="false"
rowHeight="100"
interactionMode="touch"
mouseDown="grigliaData_mouseDownHandler(event)"
mouseUp="grigliaData_mouseUpHandler(event)"
top="230" left="5" right="5" bottom="50"
dataProvider="{listaEventi}" width="100%" height="100%">
//AS Code
private var _lastClickEvent:int;
protected function grigliaData_mouseDownHandler(event:MouseEvent):void
{
_lastClickEvent = getTimer();
}
protected function grigliaData_mouseUpHandler(event:MouseEvent):void
{
if (getTimer() < _lastClickEvent + 200) // 200 = Dalay
{
// return selectedIndex
}
}
North America
Europe, Middle East and Africa
Asia Pacific