3 Replies Latest reply on Feb 20, 2008 7:44 AM by peterent

    Additional parameter to labelFunction

    Miguelitez Level 1
      Hi there,

      I am binding a dataGrid from a complex XML file. I am using the labelFunction property of the dataGridColumn, in order to retrieve information from deeper nodes. Until there, it works fine.

      Now, in order for me to reuse some of those functions, I would need to pass a parameter to the labelFunction methods I have created, so I could filter some actions. Something like:

      private function labelFunctionName(oItem:Object, dgc:AdvancedDataGridColumn , sParam:String):String
      <mx:AdvancedDataGridColumn labelFunction="labelFunctionName( 'param')" .../>.

      This is of course not working. Do you know if this is possible somehow?

      Thank you very much
        • 1. Re: Additional parameter to labelFunction
          peterent Level 2
          You cannot pass extra parameters. You should look into using an itemRenderer instead. You'll have much more control of the content.
          • 2. Re: Additional parameter to labelFunction
            Miguelitez Level 1
            Thanks for the reply Peter,

            I have used itemRenderer and it works fine.

            I have another linked question. I have setup a HTTPService to retrieve the data I am linking to the datagrid. Let us say that I use the sameHTTPService for some other calls, and at some point in time, I need to get the content of the datagrid to fill another section. That is, I need to be able to recover the content of the different rows.

            I imagined there should be a property like "data" I could use to recover my datagrid data,but the only property I can find linked to the datagrid content is rowCount, which returns the number of filled rows within my datagrid.

            Any suggestion on how I can retrieve the content of the datagrid, from an external function after it has been loaded?

            Thanks again for the previous tip
            • 3. Re: Additional parameter to labelFunction
              peterent Level 2
              The "content" of your DataGrid is the collection. You should really work with the collection, but if only have a reference to the DataGrid, then the DataGrid's dataProvider property is that collection. Remember, the DataGrid is just a view of the collection.