FragmentTable is the top-level model object passed into every data-driven component template as Model. It wraps the full result set returned by the CMS query engine for a given Fragment definition, providing the list of rows and supporting metadata.
Properties
| Property |
Type |
Description |
rows |
List<FragmentRow> |
The ordered collection of data rows returned from the Fragment table. Check for null before iterating. |
defId |
int |
The Fragment Definition ID that was queried. Matches the wc-defid attribute on the <webcore> component element. |
defName |
string |
Human-readable name of the Fragment Definition (e.g. "product-services"). |
count |
int |
Total number of rows returned. Equivalent to Model.rows.Count. |
lang |
string |
Active language code used to filter localised rows (default: "en"). |
country |
string |
Active country/region code used to filter localised rows (default: "ww"). |
Usage in a <wscript> Template
@if (Model.rows != null) {
<p>Showing @Model.count results</p>
@foreach(WebCoreFragments.FragmentRow df in Model.rows) {
<div class="item">@df.col("service-title")</div>
}
}
Always null-check Model.rows before entering a @foreach loop. The CMS sets rows to null (not an empty list) when a component has no matching records.