6 Replies Latest reply on Sep 2, 2010 1:17 PM by Flex harUI

    DataGrid Column header row display

    muthu-flex

      Hi,

       

          I am using flex datagrid to show the data dynamically. the dataprovider of the datagrid is arrayCollection. I want to display the data based on the arraycollection order. but the grid shows in sorted order. could you anybody plz help me ?

       

       

       

       

      Thanks & Regards

      Muthu

        • 1. Re: DataGrid Column header row display
          Flex harUI Adobe Employee

          What does arrayCollection order mean?

           

          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          • 2. Re: DataGrid Column header row display
            ShardulSingh Level 3

            Hi,

            By default the flex datagrid shows the data in the same order in which it is in the arraycollection,until and unless you have not used sorting on the

            arraycollection or Datagrid.But if you will click on the header of the column, it will sort according to the column data.If you want to stop this feature

            the use sortableColumns="false" with datagrid.

            Pls check for any kind of sort in you arraycollection or datagrid,if it is remove it.Also check the data of your collection separetly you will find the same

            order in the datagrid.You can check it with the code below.Hope you will be agree.

             

             

            Main Application

             

             

            <?xml version="1.0"?>
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
               <mx:Script>
               <![CDATA[
                  import mx.collections.*;
                 
            [Bindable]   
            private var dgDataProviderCollection : ArrayCollection =new ArrayCollection([
              {name : "z",age : "31"},
              {name : "y",age : "32"},
              {name : "x",age : "33"},
              {name : "w",age : "34"},
              {name : "v",age : "35"},
              {name : "u",age : "36"},
              {name : "t",age : "37"},
              {name : "s",age : "38"},
              {name : "r",age : "39"}
                     
              ])
             
               ]]>
               </mx:Script>

             

               <mx:DataGrid width="300" height="150"
                  dataProvider="{dgDataProviderCollection}" sortableColumns="false">
                  <mx:columns>
                     <mx:DataGridColumn dataField="name"/>
                     <mx:DataGridColumn dataField="age" />
                  </mx:columns>
               </mx:DataGrid>
            </mx:Application>

             

             

             

             

             

             

             

             

             

             

             

             

             

             

            with Regards,

             

            Shardul Singh Bartwal

            • 3. Re: DataGrid Column header row display
              muthu-flex Level 1

              Hi,

                   That is, the data which is added in the collection. For example: the

              column header {D, B, C, S, L, M} is stored in array collection. I want to

              display those data in the same order. But it displays alphabetic order like

              {B, C, D, L, M, S}. Please find the attachment.

               

               

              Thanks & Regards

              Muthu

              • 4. Re: DataGrid Column header row display
                ShardulSingh Level 3

                Hi,

                I am not getting your problem properly.Where you want to stop sorting,and no attachment is send by you.

                 

                 

                 

                 

                 

                 

                 

                Shardul Singh Bartwal

                • 5. Re: DataGrid Column header row display
                  samschauhan Level 1

                  I am also facing the similar issue. Can anyone help here.

                   

                  Thanks

                  Sam

                  • 6. Re: DataGrid Column header row display
                    Flex harUI Adobe Employee

                    If you have a way of determining the column order you want, you will need to

                    create an array of DataGridColumns yourself and assign them to the

                    DataGrid.column property.  There is no way to inspect and object and

                    determine the order of properties.