Hi James,
if you wait for a result in a while loop and the server takes a long
time to return the value then your interface will lock up.
you can do something like the following instead:
public function myDataTipFunction(e:HitData):String
{
// listen for result of tooltip data call
var token:AsyncToken = httpService.send();
token.addResponder(new Responder(tooltipDataResult, tooltipDataFault));
}
private function tooltipDataResult(info:Object):void
{
// update the tooltips you have stored.
}
A couple of things about this implementation:
* It seems that the DataGrid will "prefetch" twice as many tooltips as
there are items visible in the grid. so you're making a bunch of
network calls before even one tooltip is shown
* the tips are cached. so even after you get your tooltips the function
doesn't get called again. it may get called again at some point. i'm
not sure what the datagrid tooltip caching policy is.
* if you have a tooltip open but the data hasn't been fetched, and then
your result comes back, the opened tooltip will not show the new data.
the tooltip has to hide and show again for the new data to show.
it's probably easier to just roll your tooltip handler. i'd be
interested in an easier way.
hope that helps
/r
http://labs.searchcoders.com/dashboard/demo/
http://www.laflex.org/
James wrote:
> I want to get information about the item that is being hovered over. I
> don't have this information in memory, I need to get it from the web
> server, that requires waiting for a result event from HTTPService
> before returning the data I need.
>
> Thanks!
>
> --- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>> dataTipFunction should be the answer, but I don't get what you are doing
>> in the loop. Can you give more detail of what you are trying to
>> accomplish?
>>
>>
>>
>> -Alex
>>
>>
>>
>> ________________________________
>>
>> From: [email protected] [mailto:[EMAIL PROTECTED] On
>> Behalf Of James
>> Sent: Thursday, May 17, 2007 10:47 AM
>> To: [email protected]
>> Subject: [flexcoders] DataGrid dynamic toolTips or dataTips
>>
>>
>>
>> Hi all, my name is James Wilson, I am a flex programmer in the atlanta
>> area, new to the list.
>>
>> On a datagrid, I'd like to display more information about the item the
>> user is hovering over in a tooltip, but I want to get this information
>> (a fair bit) dynamically based on a case number/id from the datagrid
>> item that is being hovered over.
>>
>> The best way I can think of is to do a loop in the dataTipFunction:
>>
>> public function myDataTipFunction(e:HitData):String
>> {
>>
>> while(httpService.lastResult == null){}
>> //return tooltip based on result.
>> }
>>
>> Surely there is a better way.
>>
>> Thanks everyone. Nice to meet you all. :)
>>
>> James Wilson
>>
>
>
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
>
>
>
>