4 Replies Latest reply on Nov 7, 2009 2:47 PM by Oraxia

    AdvancedDataGrid DataTip Function Kills App

    Oraxia

      I'm a brand new Flex developer, but I didn't see anything related to my problem on the forums so I figured it would be okay to ask

       

      My problem is that if I add a dataTipFunction to my AdvancedDataGrid, my app will fail to run. The dataTipFunction right now simply returns back a string saying "testing dataTip function" (and other, more colorful and possibly nsfw messages when I'm particularly frustrated) because I can't get past the app stalling as soon as I set dataTipFunction="myDataTipFunction"

       

      I'm using iLog with this (I have a Gantt chart in another panel, for which I have a separate and working dataTipFunction), and I am remembering to set showToolTip="true" on all my AdvancedDataGridColumn items, too. I do not have any custom renderers, either--it's actually a pretty boring grid.

       

      Any ideas? I've already tried what is suggested in this blog entry:http://whatsmytitletoday.blogspot.com/2008/11/advanceddatagrid-datatipfunction-mess.html to no avail

        • 1. Re: AdvancedDataGrid DataTip Function Kills App
          paul.williams Level 4

          Can you post an example that demonstrates the problem?

          • 2. Re: AdvancedDataGrid DataTip Function Kills App
            Oraxia Level 1

            I'm not sure how exactly to demonstrate the problem, since the problem is simply that the application doesn't run, so I'll post the AdvancedDataGrid in question and the formatting function. Here is my AdvancedDataGrid:

             

            <mx:AdvancedDataGrid
                                        id="textDataGrid"
                                        width="100%"
                                        height="100%"
                                        iconFunction="getTaskIcon"

                                        dataTipFunction="myDataTipFunction">

                 <mx:dataProvider>
                      <mx:HierarchicalData id="textGridHierarchicalData" source="{currentActivities..task}"/>
                 </mx:dataProvider>
                 <mx:columns>
                      <mx:AdvancedDataGridColumn id="nameColumn" dataField="@name" headerText="Name" showDataTips="true"/>
                      <mx:AdvancedDataGridColumn id="descriptionColumn" dataField="@description" headerText="Description" showDataTips="true"/>
                      <mx:AdvancedDataGridColumn id="startColumn" dataField="@startTime" headerText="Start Time" showDataTips="true"/>
                      <mx:AdvancedDataGridColumn id="endColumn" dataField="@endTime" headerText="End Time" showDataTips="true"/>
                      <mx:AdvancedDataGridColumn id="statusColumn" dataField="@status" headerText="Status" showDataTips="true"/>
                 </mx:columns>
            </mx:AdvancedDataGrid>

             

            Here is my test data tip function (recreated, because I have since deleted it in frustration):

             

            private function myDataTipFunction(taskItem:TaskItem) : String  {

                 var dataTip:String;

                 dataTip = "I wish this dataTip would stop breaking my application.";

                 return dataTip;

            }

             

            Eventually I expected to have other things in the dataTip which would be pulled from taskItem.data, as I did with my working dataTip function for my Gantt chart, but this was put in as a test function to see if anything showed so pardon it's terrible simplicity and uselessness.

             

            If I remove the dataTipFunction line from the AdvancedDataGridColumn, the application runs and all is well (except that I have no dataTips on my grid), and as soon as I add the dataTipFunction back in, the application will not even start--blank screen ahoy!

            • 3. Re: AdvancedDataGrid DataTip Function Kills App
              paul.williams Level 4

              There is no guarantee that an instance of 'TaskItem' will be passed into your function. Given the fact that your dataProvider is XML, I can't see how the object being passed in will ever be a TaskItem. Try the following:

               

              private function myDataTipFunction( item : Object ) : String

              {

                   if ( item && item is TaskItem )

                   {

                        var taskItem : TaskItem = TaskItem( item );

                        // return some property of taskItem here

                        return "Item is a TaskItem";

                   }

                   return "Item is not a TaskItem";  

              }

               

              There's a cookbook example here:

               

              http://cookbooks.adobe.com/post_Displaying_column_header_tooltips_in_an_Advanced_D-11407.h tml

               

               

               


              • 4. Re: AdvancedDataGrid DataTip Function Kills App
                Oraxia Level 1

                Well, I am a bit of a moron Changing to an Object rather than a TaskItem (which is what I was using for my iLog GanttSheet's dataTipFunction) helped, but it seems also like the grid item requires the check for if the item exists or it will again stall the program, which my other dataTipFunction did not need--curious. Thank you!