Opening Data Items List (not Content Items List) screen from a Template

52 views Asked by At

I designed an app with a template that displays a fixed quantity of random ads on a page using a razor script like so:

var sponsors = AsDynamic(App.Data["Sponsors"]).OrderBy(x => Guid.NewGuid()).Take(6);

@Edit.Toolbar(actions: "add,contentItems", contentType: "Sponsors")

@if(sponsors.Any()) {
  foreach(var s in sponsors) {
    ...
  }
}

What I'd like to do is create a custom button at the top of the listing that opens the data items list for editing and deleting items. I'd like to do this because the module appears on all pages, and doesn't seem to follow the content model because we aren't adding specific entities to each module. And each page's module can have a different template that controls whether the ads run horizontal or vertical, as well as the ability for page editors to control the number of ads to display at a time.

It seems that because I am using a data query list (or even App.Data["Sponsors"]) and not content list that the button below will not work:

@Edit.Toolbar(actions: "add,contentItems", contentType: "Sponsors")

Is there any way to create a toolbar button to open the full data list using built-in code?

Hopefully someone has some insights into how to make a traditional Web Forms style module in 2SXC without having to retrain users on data-driven apps like these.

Happy Holidays and New Year!

--Phil

1

There are 1 answers

1
iJungleBoy On BEST ANSWER

You're in luck: 2sxc 8.8.2 fixed an issue where the contentitems button didn't appear. You should be good to go.

note that there is a minor bug in 8.8.2 - read the release notes or wait for the follow-up release.