Load tooltip content via ajax everytime it opens

5 posts, 1 answers
  1. Peter
    Peter avatar
    22 posts
    Member since:
    Nov 2007

    Posted 22 May 2013 Link to this post

    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>
  2. Answer
    Rosen
    Admin
    Rosen avatar
    3237 posts

    Posted 23 May 2013 Link to this post

    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!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Peter
    Peter avatar
    22 posts
    Member since:
    Nov 2007

    Posted 23 May 2013 Link to this post

    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!
  5. Telerik
    Telerik avatar
    4 posts
    Member since:
    Mar 2014

    Posted 16 Jun 2014 Link to this post

    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.

  6. Rosen
    Admin
    Rosen avatar
    3237 posts

    Posted 17 Jun 2014 Link to this post

    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.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready