0 Replies Latest reply on Apr 18, 2009 8:26 PM by JasonShoulet

    Passing Optional Parameter Via Extended Class Constructor

      Following is a snippet of code I copied and have a question about when extending DataGridColumn class to sort numeric for colums that have numeric values:

       

      CustomAdvancedDataGridColumn(columnName:String=null,numeric:Object=null)
      {
      super(columnName);
      initCompare(numeric);
      }

       

      function initCompare(numeric:Object):void
      {
      if (numeric == NUMERIC) {
      sortCompareFunction = numericCompare;
      }
      }

       

      The extended class is supposed to receive variable "numeric" type Object in the constructor which is then supposed to be used in the initCompare function to determine if a column contains numeric values.  This code didn't work for me as numeric variable remains null.  To get it working I added a new public static const and private propery "numeric" and obtained it with get() set() to see if should the column should sort numeric.  This works but you have to set the property in the extended datagrid column FLEX  tag.

       

      My question is how is the variable numeric in the code snippet above supposed to get it's new data for the initCompare function?  I can't get it to be anything other than null.

       

      Thanks for any insights...I'm new to FLEX.

       

      Jason