WebDrawer - Show contained Records
How would we show a list of all contained Records within the details page of a container in WebDrawer? I can think of at least two ways.
Embed contained Records
Edit detailsView.cshtml and include the code below somewhere near (or at) the bottom. This will embed up to 500 contained Records in this page.
@if (Model.TrimModel.TrimType == BaseObjectTypes.Record) { Record record = trimObject as Record; if (record.IsContainer) { <h2>Contained Records</h2> <table class="table"> <thead> <tr> <th>Title</th> <th>Number</th> </tr> </thead> <tbody> @foreach(Record containedRec in this.TrimHelper.Search<Record>( BaseObjectTypes.Record, string.Format("recContainer:{0}", record.Uri), properties: new string[] { "RecordTitle", "RecordNumber" }, pageSize: 500)) { <tr> <td><a href="~/Record/@containedRec.Uri">@containedRec.Title</a></td> <td>@containedRec.Number</td> </tr> } </tbody> </table> } }
Embed contained Records within an IFrame
It is also possible to embed the contained Records as an iframe. The advantage of this is that you can page through a large result set inside the iframe, the cost is that you will need to set up clean view without the menu and banner and link that up using the routeDefaults (in hprtrim.config).
I can provide examples of the clean view and routeDefaults on request.
<h2>Contained Records</h2> <iframe src="~/Record?q=@string.Format("recContainer:{0}", record.Uri)" width="100%" height="200"></iframe>
The result
The result of the first option above will look something like this.