11 Replies Latest reply on Jul 17, 2013 11:52 PM by Kevin Plaul

    Flex 4.3 AdvancedDatagrid Problem

    Kevin Plaul

      Dear Community,

       

      i have a strange problem with the AdvancedDatagrid in Flex 4.3. It is a simple Datagrid without any Eventhandler and so on. If i have less Rows i dont have a Problem. But if i have many Datarows (in my case about 2000) and than i press the F key, it selects a row. But why?

       

      Now it comes really strange:

       

      if a add an eventhandler that listen to the F8 Key, the Datagrid selects any Row BEFORE it throws my added event.

        • 1. Re: Flex 4.3 AdvancedDatagrid Problem
          jfb00 Level 3

          Hi,

          Can you share a sample code?

          • 2. Re: Flex 4.3 AdvancedDatagrid Problem
            Kevin Plaul Level 1

            <mx:AdvancedDataGrid id="dataGridHistorien" designViewDataType="flat" height="607"

            selectionMode="singleRow"

            editable="false"

            dataProvider="{_v_historien}"

            width="570" x="10" y="42"

            >

             

             

            the Data in the Database are:

             

            MDN_IDSerial_KeyPerson_IDDate from dater toTextGroup
            111100122013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 21
            1111030312013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 311
            1111031322013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 321
            1111032332013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 331
            1111033342013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 341
            1111034352013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 351
            1111035362013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 361
            1111036372013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 371
            1111037382013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 381
            1111038392013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 391
            1111039402013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 401
            1111040412013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 411
            1111041422013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 421
            1111042432013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 431
            1111043442013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 441
            1111044452013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 451
            1111045462013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 461
            1111046472013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 471
            1111047482013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 481
            1111048492013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 491

             

             

            the codebehind part is not important because it is not used.

             

            the _v_Historen object looks like this:

             

             

            Kevin Plaul 2013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 2
            Jack Hunter 2013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 31
            Johanna Winter2013-07-15 00:00:00.0001900-01-01 00:00:00.000Test 32

            .

            .

            .

            .

            • 3. Re: Flex 4.3 AdvancedDatagrid Problem
              jfb00 Level 3

              Kevin,

              I would like to see more of your code, no data.

              Best,

              • 4. Re: Flex 4.3 AdvancedDatagrid Problem
                Kevin Plaul Level 1

                Yeah jfb00 this is the Problem.... there is no more Code for this Datagrid excapt the line to set the dataprovider.

                 

                 

                 

                • 5. Re: Flex 4.3 AdvancedDatagrid Problem
                  jfb00 Level 3

                  I don't have flex 4.3 anymore, i am using Flash builder 4.7 with SDK 4.5.1.

                  Try taking out selectionMode="singleRow" and designViewDataType="flat"

                  • 6. Re: Flex 4.3 AdvancedDatagrid Problem
                    Kevin Plaul Level 1

                    No... i fount out what the Problem is.

                     

                    i wantet to add an event to open popup when i press "F8"... so i listen to keycode 119. but the keycode 119 is also a "w".

                     

                    and thi datagrid in flex has some kind of autosearch witch select the forst row where the text of the selected column starts with a "w"

                     

                    now is my question.-.. how can i switch this function off?

                    • 7. Re: Flex 4.3 AdvancedDatagrid Problem
                      jfb00 Level 3

                      Here is my solution:

                       

                      <?xml version="1.0" encoding="utf-8"?>

                      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                                     xmlns:s="library://ns.adobe.com/flex/spark"

                                     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="init()">

                          <fx:Declarations>

                              <!-- Place non-visual elements (e.g., services, value objects) here -->

                          </fx:Declarations>

                          <fx:Script>

                              <![CDATA[

                                  import mx.collections.ArrayCollection;

                                  import mx.controls.Alert;

                       

                                  [Bindable]

                                  private var dpFlat:ArrayCollection = new ArrayCollection([

                                      {Territory:"Arizona", Territory_Rep:"Barbara Jennings", Actual:38865, Estimate:40000},

                                      {Territory:"Arizona", Territory_Rep:"Dana Binn", Actual:29885, Estimate:30000}, 

                                      {Territory:"Central California", Territory_Rep:"Joe Smith", Actual:29134, Estimate:30000}, 

                                      {Territory:"Nevada", Territory_Rep:"Bethany Pittman", Actual:52888, Estimate:45000}, 

                                      {Territory:"Northern California", Territory_Rep:"Lauren Ipsum", Actual:38805, Estimate:40000},

                                      {Territory:"Northern California", Territory_Rep:"T.R. Smith", Actual:55498, Estimate:40000}, 

                                      {Territory:"Southern California", Territory_Rep:"Alice Treu", Actual:44985, Estimate:45000},

                                      {Territory:"Southern California", Territory_Rep:"Jane Grove", Actual:44913, Estimate:45000}

                                  ]);

                       

                                  private function init():void{

                                      myADG.addEventListener(KeyboardEvent.KEY_UP, keyHandler );

                                  }

                       

                                  private function keyHandler(event:KeyboardEvent):void{

                                      if (event.keyCode == 119 && event.charCode == 0)

                                          Alert.show ("F8 key");

                                  }

                              ]]>

                          </fx:Script>

                          <mx:AdvancedDataGrid id="myADG" editable="false" width="100%" height="100%" dataProvider="{dpFlat}"

                                               sortExpertMode="true"

                                               designViewDataType="flat"

                                               selectionMode="singleRow" >

                       

                          </mx:AdvancedDataGrid>

                      </s:Application>

                      • 8. Re: Flex 4.3 AdvancedDatagrid Problem
                        Kevin Plaul Level 1

                        i think this can not work like we want.. because the .. lets call it "quickselection" is fired BEFORE it calls you Key_Up event

                         

                        try this easy with a entry in your List that starts with "w"

                         

                        {Territory:"West California", Territory_Rep:"Will Grove", Actual:44913, Estimate:45000}

                        • 9. Re: Flex 4.3 AdvancedDatagrid Problem
                          jfb00 Level 3

                          Did you actually try my code?

                          If you have other issue please add you code to this example because I don't understand your issue.

                          Best,

                          • 10. Re: Flex 4.3 AdvancedDatagrid Problem
                            Kevin Plaul Level 1

                            Okay. my current Problem is just simple: focus a Datagrid and press a letter... now the Datagrid automaticaly select the first Row where the value of the first column (or the column witch was sorted at last) starts with this letter.

                            is this called "keyboard navigartion" ? i dont know. but this is, what i need to disable anyway.

                             

                            this is a flex function and there really esists no code. the datagrid just does this automatically

                            • 11. Re: Flex 4.3 AdvancedDatagrid Problem
                              Kevin Plaul Level 1

                              this is the solution that solved my problem.

                              with this CustomAdvancedDataGrid the charakter - quicksearch is disabeld

                               

                              public class CustomAdvancedDataGrid extends AdvancedDataGrid
                              {
                                 
                              public function CustomAdvancedDataGrid()
                                 
                              {
                                     
                              super();
                                 
                              }

                                 
                              protected override function findKey(eventCode:int):Boolean
                                 
                              {
                                     
                              return false;
                                 
                              }
                              }