4 Replies Latest reply on Sep 12, 2007 5:06 AM by Cédriic

    DataGrid columns

      Hi everyone,

      Here is my problem. I have a DataGrid which is bound to an ArrayCollection as a data provider. When no columns are specified within my MXML file, columns are automatically generated by default once the ArrayCollection is defined.
      Is there a way to prevent this default behavior ? Or at least, is there a way to know that columns are self-generated BEFORE the ArrayCollection is defined ?

      For example :
      <mx:DataProvider dataProvider="{myArrayCollection}"/>

      Hope I made it clear ...

      Thx guyz :)
        • 1. Re: DataGrid columns
          To prohibit the datagrid column to be not displayed make the column-width=0.
          Then whenever you want to dislplay just adjust the width=100% at runtime[ in script.]
          • 2. DataGrid columns
            Cédriic Level 1

            Thanks for your answer but it does not fit my problem. I don't speak about displaying columns, I only talk about the definition of columns.

            I noticed that in the source code of the DataGrid class that there is a boolean value named "generatedColumns" which tells the DataGrid whether a developer specifically declared his columns within the <mx:columns> tag. This value is modified within the collectionChangeHandler method which is called when the coresponding dataProvider is defined.
            The thing is, there is no easy way to override this callback than rewriting the code in an herited class where this method has to be redefined.

            Maybe another possibility to do so ?
            • 3. Re: DataGrid columns
              ntsiii Level 3
              What are you trying to accomplish?
              • 4. Re: DataGrid columns
                Cédriic Level 1
                Just trying to know if there is a way to know if columns were predefined by a developer before the corresponding bound dataProvider has been set.