0 Replies Latest reply on May 19, 2011 11:56 AM by bon_t

    How to apply formatting on data feeding AdvancedDataGrid

    bon_t

      Hello All,

       

      I'm using the Halo AdvancedDataGrid component, in which the default itemEditor for each column is mx.controls.TextInput.

       

      For example, the data provider is:
      [CODE][Bindable]
      private var labelsGridArray:Array = [ { tag:"apple" }, { tag:"*banana" }, { tag:"carrot" } ];[/CODE]
      And the AdvancedDataGrid definition is:
      [CODE]<mx:AdvancedDataGrid x="115" y="288" id="labelsGrid" designViewDataType="flat" dataProvider="{labelsGridArray}">[/CODE]

       

      If a String from the dataprovider Array is preceded by an asterisk - as is the case for banana in this example - the String needs to be surrounded by square brackets and be displayed in a grey colour.

       

      I tried to do the following:
      [CODE]

      <mx:itemRenderer>
          <fx:Component>
              <fx:Script>
                  <![CDATA[
                  override public function set data(value:Object):void
          ETC.
      [/CODE]
      But this code was never executed. I put breakpoints and they were never accessed, and trace statements that were never written.

       

      A colleague told me about using the AdvancedDataGridColumn's labelFunction attribute. I tried that but was unable to do the following assignment (the id of the column is 'tag'):
      [CODE]tag.itemEditor.htmlText = formattedText;[/CODE]

       

      I get error "Access of possibly undefined property htmlText through a reference with static type mx.core:IFactory.

       

      I tried to both explicitly extract the TextInput itemEditor (like I did for the override set data) AND use the labelFunction, but I couldn't get both to be in the correct scopes.

       

      Your help is much appreciated,
      Bonnie