3 Replies Latest reply on Aug 24, 2009 4:45 AM by nikos101

    Use tooltip as datatips won't work wehen using custom item renderer

    nikos101 Level 2

      When you have a custom item renderer in a advanced datagrid, am I right in understanding that you need to create a tooltip as datatips wont work in that case?

        • 1. Re: Use tooltip as datatips won't work wehen using custom item renderer
          paul.williams Level 4

          The default renderer also uses tooltips, but it populates the toolTips

          using the dataTips properties of the underlying column / grid. You can

          code your custom renderer to also support these dataTips properties.

          Open the source file for DataGridItemRenderer (ctrlshiftT in FB), and

          look at the validateProperties method for an example.

           

          Alternatively you can just add your own custom tooltips to your item

          renderer and ignore the dataTips properties of the column / grid.

          1 person found this helpful
          • 2. Re: Use tooltip as datatips won't work wehen using custom item renderer
            nikos101 Level 2

            So how exactly would I do that for this    <mx:itemRenderer> Do I need to override the validate properties?

             

            <mx:AdvancedDataGridColumn dataField="status" showDataTips="true" dataTipFunction="dataTipFuncOverrideDetails" labelFunction="CommonFunctions.labelFuncStatus" headerText="" textAlign="center" wordWrap="true" width="25">
                            <mx:itemRenderer>
                                <mx:Component>
                                    <mx:Label  xmlns:mx="http://www.adobe.com/2006/mxml">
                                        <mx:Script>
                                            <![CDATA[
                                       
                                                                   
                                                override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
                                                {
                                                    if (data != null && data.children == null)
                                                    {
                                                        super.updateDisplayList(unscaledWidth, unscaledHeight);
                                                        var g:Graphics=graphics;
                                                        g.clear();
                                                        if (data.status == 0)
                                                        {
                                                            //unmatched
                                                            g.beginFill(0xffaaaa);
                                                            g.drawRect(0, 0, unscaledWidth, unscaledHeight);
                                                            g.endFill();
                                                        }
                                                        else if (data.status == 1)
                                                        {
                                                            //matched
                                                            g.beginFill(0xaaffaa);
                                                            g.drawRect(0, 0, unscaledWidth, unscaledHeight);
                                                            g.endFill();
                                                        }
                                                        else if (data.status == 2)
                                                        {
                                                            //matched
                                                            g.beginFill(0xaaaaff);
                                                            g.drawRect(0, 0, unscaledWidth, unscaledHeight);
                                                            g.endFill();
                                                        }
                                                    }
                                                }
                                            ]]>
                                        </mx:Script>
                                    </mx:Label>
                                </mx:Component>
                            </mx:itemRenderer>
                        </mx:AdvancedDataGridColumn>

             

            Thanks very much for your advice

            • 3. Re: Use tooltip as datatips won't work wehen using custom item renderer
              nikos101 Level 2

              this solved it

               

                      <mx:Label toolTip="{'Status was overridden by ' + data.name + '\n' + data.statusWasOverriddenWhen + '\n' + data.whenStatusWasOverridden}"  xmlns:mx="http://www.adobe.com/2006/mxml">