Use dataTipFunction instead of dataTip. In the datatip function, you can show datatip or not, by checking length of string. Here is the example:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:XMLList id="testData"> <row> <col1>1</col1> <col2>Zzzzzzzzzzzzzzzzzzzzzzzzzzzzz</col2> </row> <row> <col1>2</col1> <col2>G</col2> </row> </mx:XMLList> <mx:Script> <![CDATA[ private function showCol1(item:Object):String { var str1:String = item.col1; if (str1.length > 10) return item.col1; else return ""; } private function showCol2(item:Object):String { var str1:String = item.col2; if (str1.length > 10) return item.col2; else return ""; } ]]> </mx:Script> <mx:DataGrid id="dataTable" dataProvider="{testData}"> <mx:columns> <mx:DataGridColumn headerText="Column 1" showDataTips="true" dataTipFunction="showCol1" dataField="col1" /> <mx:DataGridColumn headerText="Column 2" showDataTips="true" dataTipFunction="showCol2" dataField="col2" /> </mx:columns> </mx:DataGrid> </mx:Application> Jay Jayaraman Central Billing Services Financial Management and Planning (404) 498-8453 (W) (404) 273-7131 (C) "Sydney R. Bennett" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 01/31/2008 04:27 PM Please respond to [email protected] To [email protected] cc Subject [AFFUG Discuss] Datagrid and dataTip I'm trying to get dataTip to work on a DataGrid. My dataProvider is an XMLList. But no matter what I do the dataTip that pops up contains the entire XML. Also, it seems the tip pops up for every cell and not just for the cells that get truncated. Has anyone run into this? I am thinking it doesn't like XML.... Thanks, Syd Here's my code: <?xml version="1.0" encoding="utf-8"?> <mx:XMLList id="testData"> <row> <col1>1</col1> <col2>Zzzzzzzzzzzzzzzzzzzzzzzzzzzzz</col2> </row> <row> <col1>2</col1> <col2>G</col2> </row> </mx:XMLList> <mx:DataGrid id="dataTable" dataProvider="{testData}"> <mx:columns> <mx:DataGridColumn headerText="Column 1" showDataTips="true" dataTipField="col1" dataField="col1" /> <mx:DataGridColumn headerText="Column 2" showDataTips="true" dataTipField="col2" dataField="col2" /> </mx:columns> </mx:DataGrid> </mx:Application> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by FusionLink ------------------------------------------------------------- ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by http://www.fusionlink.com -------------------------------------------------------------
