1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Custom widget for a Dynamic Module with paging, filtering, sorting

Custom widget for a Dynamic Module with paging, filtering, sorting

8 posts, 0 answered
  1. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    23 Nov 2012
    Link to this post
    Hi all,

    I'm trying to figure out what would be the best way to create a custom widget which is doing the following:

    - Show a list of Dynamic Content items (have this working)
    Through the API I can collect Dynamic Module items and show them inmy widget. No big deal.

    - Add paging to it (how to use the API to get paging working?)
    I can of course use the LINQ 'take'and 'skip' methods, but that would not be very performing and I also need a total count. I see a method on the DynamicModuleManager called 'GetCount'. But apparently this is not implemented? I need 2 pagers: on top and on the bottom of the page.

    - Add sorting
    Also need to sort the list based on some fields that the user can click (asc and desc)

    - Filter though custom taxa fields
    I have two custom taxonomy fields that are shown on the page with this widget. Clicking on it should filter the list with Dynamic Content Items.

    Anyone done this before?
    I would love some guidelines on this.

    Thanks,
    Daniel
  2. Slavo
    Slavo avatar
    295 posts
    Registered:
    24 Sep 2012
    28 Nov 2012
    Link to this post
    Hi Daniel,

    Is there any reason you're not using the default widget supplied by the dynamic module for this? It supports everything you've mentioned. You have to configure the taxonomy control to filter by a taxonomy, but it's a matter of setting the properties. The only thing you may have to do in code is the sorting part to be done runtime, where you just set the sort expression of the dynamic content view.

    Let me know if you need more details on how to configure the widget.

    Regards,
    Slavo
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    28 Nov 2012 in reply to Slavo
    Link to this post
    Hi Slavo,

    I think the filtering will work. Sorting I have not worked with yet inside dynamic modules. It is just that I want to follow a certain design, and I'm not sure this will work with the default widget out-of-the-box. If it is possible, then I would surely go for that.

    Just take a look at this webpage:
    http://www.evangelischegemeente.nl/media

    This is a SF3.7 website, which I'm upgrading to 5.2. It should look like this.

    So if I filter, the paging and sorting should also still work.

    If it would be possible to use a custom usercontrol that is set as template, then that would be great. I don't want to go with creating the 'OpenAccess<GUID> files in the root of my project. If that is still the case to create custom code, I want to do it myself in a custom widget.

    Please let me know if you have any example on how to do this?

    Thanks,
    Daniel
  4. Slavo
    Slavo avatar
    295 posts
    Registered:
    24 Sep 2012
    30 Nov 2012
    Link to this post
    Hi Daniel,

    I think the same functionality as the site you've shown can be achieved with the default widget and some styling. The only thing you may have to implement with a separate widget is the setting of how many items per page to show. Even if you have to implement some of the things, I think it would be much easier compared to implementing the whole widget from scratch.

    You won't have to deal with OpenAccess<guid> files, and you can modify the templates for the widget showing dynamic items as you wish.

    Here is some info on what you can configure in the default behavior of those widgets:
    http://www.sitefinity.com/documentation/documentationarticles/user-guide/widgets/content-widgets-group/configuring-custom-module-widgets

    We'd be happy to assist with any extensions that have to be written.

    Regards,
    Slavo
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    30 Nov 2012 in reply to Slavo
    Link to this post
    Hi Slavo,

    I know I can modify the templates through e.g. Thunder. Just wondering how I should for example doing the sorting. I need to track which button a visitor clicks on: 'Date', 'Title' etc... also, when clicking the first time, it should sort ascending, clicking the second time, it should be descending.

    How would I modify the default widget template, to make this actually happen? I can't see a way without writing custom code. Since we cannot use custom code with dynamic widgets, because pointing to an external template through the LayoutTemplatePath property doesn't work.

    So, still any help or example would help me.

    Thanks,
    Daniel
  6. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    06 Dec 2012
    Link to this post
    Hello Daniel,

    It's indeed true that exposing the LayoutTemplatePath implementation is not part of the DynamicContentView controls, however you can try mapping an external template using the second part of Josh's blog post or alternatively inherit from DynamicContentView itself and substitute the default Views, or directly plug in on the InitializeControls method and modify the FilterExpression or DataSource which should both be available there.

    Regards,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    06 Dec 2012 in reply to Boyan Barnev
    Link to this post
    Hi Boyan,

    I indeed figured that out. I'm now doing my own implementation of the DynamicContentViewMaster and that works okay.

    Nevertheless it would be great if we could use the LayoutTemplatePath implementation as in the other modules.

    Regards,
    Daniel
  8. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    11 Dec 2012
    Link to this post
    Hello Daniel,

    Thank you for getting back to us. Yes, indeed I agree with you that implementing the LayoutTemplatePath for DynamicContentView controls would be beneficial, we would definitely consider it when planning our upcoming releases, we are gradually trying to address all our client's feedback.

    All the best,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
8 posts, 0 answered