More in this section

Forums / Developing with Sitefinity / Pagewide glossary tooltips

Pagewide glossary tooltips

4 posts, 0 answered
  1. Darth Obiwan
    Darth Obiwan avatar
    4 posts
    Registered:
    25 Jun 2009
    25 Jun 2009
    Link to this post
    I'm just starting with sitefinity today and so far after quite a bit of searching I haven't been able to find a clear way to filter content before it's displayed on the page. I want to avoid using Response.Filter if I can.

    Basically, I have a Glossary list defined in the Lists module. I want to take each term defined in there and make a tooltip for that term wherever it appears on the page.

    Is there someway to register a filter for any IContent modules? Some sort of observer pattern?

    From what I can tell so far I'm going to have to write a dynamic jquery script to tag all the items on the page and then call up the tooltip info from a webservice.
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    29 Jun 2009
    Link to this post
    Hello Jeff,

    Thank you for your interest in our CMS.

    I spent some time thing about your requirement, but could not come with an easier approach than yours.
    One thing to note though - the Lists module is not a Generic Content based one, so it does not have IContent items. Please take a look at the Lists Module API for more information.

    Greetings,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Darth Obiwan
    Darth Obiwan avatar
    4 posts
    Registered:
    25 Jun 2009
    29 Jun 2009
    Link to this post
    I ended up implementing it with jQuery.

    I wrote an ASP.NET control that just contains a JS block as it's content and it retrieves the list of terms from the "Glossary" list, passing them in as an array into the jQuery Search Highlighter plugin.

    After that I use a small function to attach a ajax request to each of the terms with the qTip tooltip plugin. That request passes the term to a service page that returns the content of the term in the list. It works rather well.

    I wouldn't be too hard to extend this to be a module so the list to draw from is controlled via the admin page.

    One thing I'm finding that would probably be helpful in future versions of sitefinity is to change all the collections that implement IList to IList<T>. This way we can run LINQ on them without first having to run Cast<T>() on them.

    glossaryList.Items.Cast<IListItem>().Where(x => x.Headline.ToLower().Equals(term.ToLower())).FirstOrDefault(); 

    Changing to IList<T> still maintains 2.0 compatability and makes using LINQ over the API much easier.
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    29 Jun 2009
    Link to this post
    Hello Jeff,

    Thank you for your follow up.
    In the future versions of Sitefinity, the Lists module will be based on Generic Content. Generic Content API itself will be improved a lot, and the LINQ wil work over it. This approach will actually replace the existing ContentFilter classes and FitlerExpressions for selecting the content.

    Kind regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
4 posts, 0 answered