Custom Module: are multiple backend views possible?

Posted by Community Admin on 04-Aug-2018 20:57

Custom Module: are multiple backend views possible?

All Replies

Posted by Community Admin on 16-Jan-2012 00:00

I have a custom module that was created from code rather than by use of the Module builder.  The module is used to create School Calendar Day Items that identify "out of session" dates and reasons (Holidays, Vacation, Staff Development Days, etc.)

Each "SchoolCalendarDay" has a "SchoolYearCalendar" and a "SchoolCalendarDayType" associated with it. My table mappings are setup and working properly and look like this.

MappingConfiguration<SchoolYearCalendar> schoolYearCalendarTableMapping = new MappingConfiguration<SchoolYearCalendar>();
schoolYearCalendarTableMapping.MapType().ToTable("sf_nlg_school_year_calendar");
schoolYearCalendarTableMapping.HasProperty(y => y.Id).IsIdentity(Telerik.OpenAccess.Metadata.KeyGenerator.Guid);
schoolYearCalendarTableMapping.HasProperty(y => y.StartDate).IsNotNullable();
schoolYearCalendarTableMapping.HasProperty(y => y.EndDate).IsNotNullable();
schoolYearCalendarTableMapping.HasProperty(y => y.CreatedBy).IsNotNullable();
schoolYearCalendarTableMapping.HasProperty(y => y.CreateDate).IsNotNullable();
 
MappingConfiguration<SchoolCalendarDay> calendarDayTableMapping = new MappingConfiguration<SchoolCalendarDay>();
calendarDayTableMapping.MapType().ToTable("sf_nlg_school_year_calendar_day");
calendarDayTableMapping.HasProperty(d => d.Id).IsIdentity(Telerik.OpenAccess.Metadata.KeyGenerator.Guid);
calendarDayTableMapping.HasProperty(d => d.SchoolYearCalendarId).IsNotNullable();
calendarDayTableMapping.HasProperty(d => d.Date).IsNotNullable();
calendarDayTableMapping.HasProperty(d => d.CreatedBy).IsNotNullable();
calendarDayTableMapping.HasProperty(d => d.CreateDate).IsNotNullable();
calendarDayTableMapping.HasProperty(d => d.SchoolDayTypeId).IsNotNullable();
calendarDayTableMapping.HasProperty(d => d.AdditionalInfo);
 
MappingConfiguration<SchoolCalendarDayType> calendarDayTypeTableMapping = new MappingConfiguration<SchoolCalendarDayType>();
calendarDayTypeTableMapping.MapType().ToTable("sf_nlg_school_year_calendar_day_type");
calendarDayTypeTableMapping.HasProperty(t => t.Id).IsIdentity(Telerik.OpenAccess.Metadata.KeyGenerator.Autoinc);
calendarDayTypeTableMapping.HasProperty(t => t.Description).IsNotNullable();
calendarDayTypeTableMapping.HasProperty(t => t.SortOrder).IsNotNullable();
 
calendarDayTableMapping.HasAssociation(d => d.DayType).ToColumn("school_day_type_id");
calendarDayTableMapping.HasAssociation(d => d.SchoolCalendar).ToColumn("school_year_calendar_id");
 
List<MappingConfiguration> mappings = new List<MappingConfiguration>();
mappings.Add(calendarDayTypeTableMapping);
mappings.Add(schoolYearCalendarTableMapping);
mappings.Add(calendarDayTableMapping);

I created a "SchoolCalendarAdminView" and "AddEditSchoolCalendarView" controls so I can add and edit new SchoolCalendarDay items. While everything works properly, I also need a way to add/edit "SchoolYearCalendar" and "SchoolCalendarDayType" items.

Is it possible for a module to have multiple backend views or do I need to create seperate SchoolYearCalendar and SchoolCalendarDayType modules?

--Steve


Posted by Community Admin on 18-Jan-2012 00:00

Hi Steve,

Yes, a single module can have different Backend pages associated with it and each page would invoke different create/edit views - it's just a matter of definitions. For example the Locations module from the SDK has the following definition:

var locationsGridView = new MasterGridViewElement(backendContentView.ViewsConfig)
    ViewName = LocationsDefinitions.BackendListViewName,
    ViewType = typeof(MasterGridView),
    AllowPaging = true,
    DisplayMode = FieldDisplayMode.Read,
    ItemsPerPage = 50,
    SearchFields = "Title",
    SortExpression = "Title ASC",
    Title = "Locations",
    WebServiceBaseUrl = "~/Sitefinity/Services/Content/Locations.svc/"
;
backendContentView.ViewsConfig.Add(locationsGridView);

As you can see there is a property named ViewName and it points to LocationsDefinitions.BackendListViewName, which is the name for the grid view for the Locations. You can have several such views in one module.

All the best,
Lubomir Velkov
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

Posted by Community Admin on 19-Jan-2012 00:00

Hi Lubomir,

Thanks for the info.

Steve

This thread is closed