2 Replies Latest reply on Sep 14, 2006 9:15 AM by jtan

    Item renderer in datagrid

    trycold
      Hi,

      For one of the columns in my datagrid if the value is null or undefined then I want it to write 0 in there otherwise it should have the dataprovider value. That column is eidtable also. Do I have to use item renderer for this? if yes can you give me an example. I tried doing it but didn't work.

      Thanks,
        • 1. Re: Item renderer in datagrid
          Level 1
          you might be able to use the labelField for the display of the value - from reading the language reference, it says you can use both a datafield and label field and the labelField would be used for display and the dataField would be used for sorting.

          It would be a lot simpler than using a renderer, hopefully. :)
          • 2. Re: Item renderer in datagrid
            jtan Level 1
            You don't need to use an itemRenderer, just use the labelFunction. Here is an example:

            private function labelFunc(item:Object, column:DataGridColumn):String
            {
            if(item.data == null || item.data ==undefined)
            {
            return "0";
            }
            else
            {
            return item.data;
            }
            }

            then, on your dataGridColumn set labelFunction="labelFunc"

            Joan Lafferty
            Flex SDK QA