3 Replies Latest reply on Dec 21, 2011 6:58 AM by Z4g0s

    Spark Datagrid on a mobile application, problem handling scrolling

    Z4g0s Level 1

      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...

        • 1. Re: Spark Datagrid on a mobile application, problem handling scrolling
          Shongrunden Adobe Employee

          The spark DataGrid hasn't been upgraded to distinguish between touch selection and touch scrolling like the spark List.  This along with performance are reasons why the spark DataGrid is not optimized for or recommended for use on mobile devices.

          • 2. Re: Spark Datagrid on a mobile application, problem handling scrolling
            Z4g0s Level 1

            thank you...

             

            Could you give me some advice on how to add the touch scrolling behaviour to the datagrid? (or at least if it's possible without being crazy?)

            • 3. Re: Spark Datagrid on a mobile application, problem handling scrolling
              Z4g0s Level 1

              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

                          }

                      }