This is a migrated thread and some comments may be shown as answers.

Load tooltip content via ajax everytime it opens

4 Answers 223 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 2
Peter asked on 22 May 2013, 09:24 PM
I'm trying to get search results to display in a tooltip window.  I've got the tooltip working to pass my search text to my partial view, but it only works on the first call.  Every time the tooltip loads again, the results are the same, because the content is never reloaded.  Is there a way to not cache what comes back from the tooltips .LoadContentFrom function, so that I can pass new parameters back to the partial view each time?
Here is what I have for the tooltip.
What I'd like is that everytime the tooltip is show, the LoadContentFrom is called.
@(Html.Kendo().Tooltip()
    .For("#searchButton")   
    .LoadContentFrom("AllSearch", "Search", new { area = "" })   
    .ShowOn(TooltipShowOnEvent.Click)
    .Position(TooltipPosition.Bottom)
    .AutoHide(false)
    .Width(600)
    .Height(600)
    .Callout(true)
    .Animation(true)   
    .Events(e =>
        {
            e.RequestStart("requestStart");           
        })
)

<script>
    function requestStart(e) {
        var st = $("#searchText").val();
 
        e.options.data = {
            searchText: st
        }
    }
     
</script>

4 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 23 May 2013, 06:31 AM
Hello Peter,

You may manually refresh the Tooltip content by calling its refresh method from within the Show event handler:

@(Html.Kendo().Tooltip()
    //...
    .Events(e =>
        {
           //...
            e.Show("show");          
        })
)
<script type="text/javascript">
    function show() {
        this.refresh();
    }
</script>

Regards,
Rosen
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Peter
Top achievements
Rank 2
answered on 23 May 2013, 03:55 PM
Thanks for the quick response.  That didn't work in the version of the controls I was using.  I upgraded to the latest and it works great!
0
Telerik
Top achievements
Rank 1
answered on 16 Jun 2014, 09:55 AM
Hi,  just need to jump on this too.  I'm setting up tooltips as part of another htmlHelper as follows (with version 2014.1.528)...

TooltipBuilder ttb = html.Kendo().Tooltip();

ttb.For("#"+field);
ttb.ShowOn(TooltipShowOnEvent.Click);
ttb.Position(TooltipPosition.Right);
ttb.AutoHide(false);
ttb.Width(750);
ttb.Height(700);
ttb.LoadContentFrom("EditSelectedField", "Resource", new { context = context, field = buddyField } ); 

ttb.Events(e => e.Show("showEditor"));

I have a javascript function on the page for the event...

function showEditor(e) {
                this.refresh();
}

The function is called whenever the tooltip is shown, but the content is only retrieved from the controller first time through.

Cheers,

Andy.

0
Rosen
Telerik team
answered on 17 Jun 2014, 06:25 AM
Hi Andy,

I'm afraid that it is not clear, looking at the provided information, what may be the cause for the issue you are facing. Therefore, it will be appreciated if you could provide a small sample in which this behavior can be observed locally.

Regards,
Rosen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ToolTip
Asked by
Peter
Top achievements
Rank 2
Answers by
Rosen
Telerik team
Peter
Top achievements
Rank 2
Telerik
Top achievements
Rank 1
Share this question
or