0 Replies Latest reply on Sep 28, 2006 6:34 PM by jpwrunyan

    Question about custom components

    jpwrunyan Level 1
      I am making a custom datagrid that has several preset functions for convenience. Following the examples on making templates from the documentation, I have found how to set my own tags for use in mxml.

      I want to do something similar with the columns element of my datagrid. Currently I often write it out like this:
      <!-- extends mx:DataGrid -->
      <custom:MyDataGrid>
       <custom:columns>
        <mx:DataGridColumn headerText="No." labelFunction="{MyDataGrid.commonRowFormat}" width="45" />
        ..
       </custom:columns>
      </custom:MyDataGrid>

      even this requires a lot of typing and essentially if the label function is going to be a common resource, I would just as soon make the other attributes of the "No." column common as well... I tried making a getter to return an instance of DataGridColumn but the MXML didn't go for it. Basically, is it possible to make my custom component so that it can be written in MXML like this?

      <custom:MyDataGrid>
       <custom:columns>
        <-- instance of mx:DataGridColumn, defaults already set -->
        <custom:rowColumn />
        ..
       </custom:columns>
      </custom:MyDataGrid>