0 Replies Latest reply on Nov 22, 2015 5:42 AM by hissizadam

    Datagrid Scrolling Problem

    hissizadam Level 1

      Hi all,

       

      I fetched data from xml database file and listed in datagrid.

      Sorting cells asc. or dsc. using data table headers. I have a

      some buttons (for go to another pages) and using a click handler event.

       

      I have an another page, it's a details page. When clicked to any cell listed in datagrid,

      showing details a selected item from data grid and i using a selectionChange event for

      binding to details page.

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
              xmlns:s="library://ns.adobe.com/flex/spark" 
              xmlns:mx="library://ns.adobe.com/flex/mx"
              title="Şirket Rehberi"
              xmlns:katistemployees="services.employees.*"   
              xmlns:empistanbul="services.employees.*"
              creationComplete="srv.send()">
      
          
          <fx:Script>
              <![CDATA[
                  import mx.events.FlexEvent;
                  import mx.events.StateChangeEvent;
                  import spark.events.GridEvent;
                  import spark.events.GridSelectionEvent;
                  import spark.events.IndexChangeEvent;
                  
                  protected function Search_clickHandler(event:MouseEvent):void
                  {
                      navigator.pushView(views.Search);    
                  }
                  
                  protected function list_selectionChangeHandler(event:GridSelectionEvent):void
                  {                
                      navigator.pushView(EmployeeDetails, list.selectedItem)    
                  }
                  
                  protected function Kategori_clickHandler(event:MouseEvent):void
                  {
                      navigator.pushView(views.Kategori);    
                  }
                  
              ]]>
          </fx:Script>
          
          
          <fx:Declarations>
              <s:HTTPService id="srv" url="assets/employees.xml"/>    
          </fx:Declarations>
          
          <s:actionContent>
              <s:Button icon="@Embed('assets/search.png')" click="Search_clickHandler(event)"/>  
              <s:Button icon="@Embed('assets/kategori.png')" click="Kategori_clickHandler(event)"/> 
          </s:actionContent> 
          <s:VGroup width="100%" height="100%">
              <s:DataGrid id="list" width="100%" height="100%" color="black"
                          dataProvider="{srv.lastResult.list.employee}"
                          selectionChange="list_selectionChangeHandler(event)">
                  <s:columns>
                      <s:ArrayList>
                          <s:GridColumn dataField="firstName" headerText="Ad"  />
                          <s:GridColumn dataField="lastName" headerText="Soyad"/>
                          <s:GridColumn dataField="title" headerText="Ünvan"/>
                          <s:GridColumn dataField="city" headerText="Bölge"/>
                          <s:GridColumn dataField="department" headerText="Müdürlük"/>
                          <s:GridColumn dataField="detay" headerText="Detay" />
                      </s:ArrayList>
                  </s:columns>
              </s:DataGrid>
          </s:VGroup>
          
      </s:View>
          
      
      

       

       

      it's work

      but

      i have a scrolling problem now. when i touch the screen for scrolling the page, going to details page because i used a selection change event before.

      if i try to using a gridclick event or etc. showing a this error message.

       

      "1067: Implicit coercion of a value of type spark.events:GridEvent to an unrelated type spark.events:GridSelectionEvent.    Liste.mxml    /EmployeeDirectory/src/views    line 49    Flex Problem"

       

      this project is very very important for me.

      can somebody help me please?

       

      thanks.