3 Replies Latest reply on Nov 27, 2006 10:27 AM by ntsiii

    DataGridColumn, labelFunction

      If using AS3 to define my DataGridColumn from an array. The array also contain the name of the function that should be performed by the labelFunction, how do assign the variable as it will not accept it as a string.

      var dg:DataGridColumn = new DataGridColumn();
      dg.dataField = fields .Presentation;
      dg.headerText = fields
      dg.labelFunction = ????;

      Thank you all
        • 1. Re: DataGridColumn, labelFunction
          peterent Level 2
          dg.labelFunction = formatPrices;

          private var formatPrices( item:Object, col:* ) : String { ... }

          A function is a variable, too. It is the equivalent of: var formatPrices:Function = function(item:Object,col:*):String { ... }
          • 2. Re: DataGridColumn, labelFunction
            Hanno1962 Level 1
            Thank you for taking the time on a sunday here. I understand your solution and I have my way now,

            However coming from a CF environment I am struggling which what I call dynamic references. In the below example the value for the formula comes from a CFC query that references my formula.

            Somehow it will NOT take it when I state dg.labelFunction = [cfcreturn_value] : which is the exact name of my formula. Is this a correct observation ?

            Another issue is how to compose a valid string. For example I want to refer to a field : Formula2, using 'Formula'+[variable].

            right now I ended up hardcoding this in my function : example : return nf.format(item["Formula2"])

            Can this be done ?

            • 3. Re: DataGridColumn, labelFunction
              ntsiii Level 3
              I don't know CF, but you should be able to reference the "field" using bracket notation:
              return nf.format(item["Formula" + variable])