PivotGridV2Builder
Methods
AutoBind(System.Boolean)
If set to "false", the PivotGridV2 will not bind to the DataSource during initialization. In this case, the data binding will occur when the Change event of the DataSource fires. By default the PivotGridV2 will bind to its DataSource specified in the configuration.
Parameters
value - System.Boolean
The value that configures the AutoBind option.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.AutoBind(false)
.DataSource(...)
)
Navigatable(System.Boolean)
If set to "true", the user could navigate the component by using the keyboard navigation. By default, keyboard navigation is disabled.
Parameters
value - System.Boolean
The value that configures the Navigatable option.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.Navigatable(true)
)
Pdf(System.Action)
Configures the PivotGridV2 PDF PDF export settings.
Parameters
configurator - System.Action<PivotGridV2PdfSettingsBuilder>
The action that configures the PDF export settings.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.Pdf(pdf => pdf.PaperSize("A4"))
)
ColumnWidth(System.Double)
Defines the width of the table columns. The value is treated as pixels.
Parameters
value - System.Double
The value that configures the width of the table columns.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.ColumnWidth(200)
)
Height(System.Double)
The height of the PivotGridV2. The value is treated as pixels.
Parameters
value - System.Double
The value that configures the height.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.Height(550)
)
ColumnHeaderTemplate(System.String)
Defines the template that renders the content of the column header cell. By default, the column header cell renders the caption of the tuple member. The available fields in the template are: - member: The member of the corresponding column header cell. - tuple: The tuple of the corresponding column header cell.
Parameters
value - System.String
The value that configures the column header template.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.ColumnHeaderTemplate("<em>#: member.caption #</em>")
)
ColumnHeaderTemplateId(System.String)
Defines the template that renders the content of the column header cell. By default, the column header cell renders the caption of the tuple member. The available fields in the template are: - member: The member of the corresponding column header cell. - tuple: The tuple of the corresponding column header cell.
Parameters
value - System.String
The "id" of the external Kendo UI template.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.ColumnHeaderTemplateId("columnTemplate")
)
<script id="columnTemplate" type="text/x-kendo-template">
#if (member.name === "[Date].[Calendar].[Year].&[2005]") { #
<em>#: member.caption #</em>
# } else { #
#: member.caption #
# } #
</script>
DataCellTemplate(System.String)
Defines the template that renders the content of the data cell. By default, the data cell renders the formatted value (fmtValue) of the data item. The available fields in the template are: - columnTuple: The tuple of the corresponding column header cell. - rowTuple: The tuple of the corresponding row header cell. - measure: The value of the data cell measure. - dataItem: The data item itself.
Parameters
value - System.String
The value that configures the data cell template.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.DataCellTemplate("<b>#: dataItem.value #</b>")
)
DataCellTemplateId(System.String)
Defines the template that renders the content of the data cell. By default, the data cell renders the formatted value (fmtValue) of the data item. The available fields in the template are: - columnTuple: The tuple of the corresponding column header cell. - rowTuple: The tuple of the corresponding row header cell. - measure: The value of the data cell measure. - dataItem: The data item itself.
Parameters
value - System.String
The "id" of the external Kendo UI template.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.DataCellTemplateId("dataCellTemplate")
)
<script id="dataCellTemplate" type="text/x-kendo-template">
#if (columnTuple.members[0].name === "[Date].[Calendar].[Calendar Year].&[2010]") { #
<b>#: dataItem.value #</b>
# } else { #
#: dataItem.fmtValue #
# } #
</script>
RowHeaderTemplate(System.String)
Defines the template that renders the content of the row header cell. By default, the row header cell renders the caption of the tuple member. The available fields in the template are: - member: The member of the corresponding row header cell. - tuple: The tuple of the corresponding row header cell.
Parameters
value - System.String
The value that configures the row header template.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.RowHeaderTemplate("<em>#: member.caption #</em>")
)
RowHeaderTemplateId(System.String)
Defines the template that renders the content of the row header cell. By default, the row header cell renders the caption of the tuple member. The available fields in the template are: - member: The member of the corresponding row header cell. - tuple: The tuple of the corresponding row header cell.
Parameters
value - System.String
The "id" of the external Kendo UI template.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.RowHeaderTemplateId("rowHeaderTemplate")
)
<script id="rowHeaderTemplate" type="text/x-kendo-template">
# if (member.name === "[Date].[Calendar].[Year].amp;[2005]") { #
<em>#: member.caption #</em>
# } else { #
#: member.caption #
# } #
</script>
ColumnHeaderTemplateView(System.Web.Mvc.MvcHtmlString)
Defines the template that renders the content of the column header cell. By default, the column header cell renders the caption of the tuple member. The available fields in the template are: - member: The member of the corresponding column header cell. - tuple: The tuple of the corresponding column header cell.
Parameters
value - System.Web.Mvc.MvcHtmlString
The Razor View that will render the template content.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.ColumnHeaderTemplateView(Html.Partial("ColumnHeaderTemplateView"))
)
ColumnHeaderTemplateHandler(System.String)
Defines the template that renders the content of the column header cell. By default, the column header cell renders the caption of the tuple member. The available fields in the template are: - member: The member of the corresponding column header cell. - tuple: The tuple of the corresponding column header cell.
Parameters
value - System.String
The JavaScript function that will return the template content.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.ColumnHeaderTemplateHandler("getColumnHeaderTemplate")
)
<script>
function getColumnHeaderTemplate(data) {
return `<em>${data.member.caption}</em>`;
}
</script>
DataCellTemplateView(System.Web.Mvc.MvcHtmlString)
Defines the template that renders the content of the data cell. By default, the data cell renders the formatted value (fmtValue) of the data item. The available fields in the template are: - columnTuple: The tuple of the corresponding column header cell. - rowTuple: The tuple of the corresponding row header cell. - measure: The value of the data cell measure. - dataItem: The data item itself.
Parameters
value - System.Web.Mvc.MvcHtmlString
The Razor View that will render the template content.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.DataCellTemplateView(Html.Partial("DataCellTemplateView"))
)
DataCellTemplateHandler(System.String)
Defines the template that renders the content of the data cell. By default, the data cell renders the formatted value (fmtValue) of the data item. The available fields in the template are: - columnTuple: The tuple of the corresponding column header cell. - rowTuple: The tuple of the corresponding row header cell. - measure: The value of the data cell measure. - dataItem: The data item itself.
Parameters
value - System.String
The JavaScript function that will return the template content.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.DataCellTemplateHandler("getDataCellTemplate")
)
<script>
function getDataCellTemplate(data) {
return `<b>${data.dataItem.value}</b>`;
}
</script>
RowHeaderTemplateView(System.Web.Mvc.MvcHtmlString)
Defines the template that renders the content of the row header cell. By default, the row header cell renders the caption of the tuple member. The available fields in the template are: - member: The member of the corresponding row header cell. - tuple: The tuple of the corresponding row header cell.
Parameters
value - System.Web.Mvc.MvcHtmlString
The Razor View that will render the template content.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.RowHeaderTemplateView(Html.Partial("RowHeaderTemplateView"))
)
RowHeaderTemplateHandler(System.String)
Defines the template that renders the content of the row header cell. By default, the row header cell renders the caption of the tuple member. The available fields in the template are: - member: The member of the corresponding row header cell. - tuple: The tuple of the corresponding row header cell.
Parameters
value - System.String
The JavaScript function that will return the template content.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.RowHeaderTemplateHandler("getRowHeaderTemplate")
)
<script>
function getRowHeaderTemplate(data) {
return `<em>${data.member.caption}</em>`;
}
</script>
Events(System.Action)
Configures the handled client-side events of the PivotGridV2.
Parameters
configurator - System.Action<PivotGridV2EventBuilder>
The action that configures the available events.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.Events(events => events.DataBinding("onDataBinding"))
)
DataSource(System.Action)
Sets the DataSource configuration of the grid.
Parameters
configurator - System.Action<PivotDataSourceV2Builder>
The lambda that configures the DataSource settings.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.DataSource(dataSource => dataSource.Xmla()
.Columns(columns => {
columns.Add("[Product].[Category]");
})
.Rows(rows => rows.Add("[Geography].[City]"))
.Measures(measures => measures.Values(new string[]{"[Measures].[Reseller Freight Cost]"}))
.Transport(transport => transport
.Connection(connection => connection
.Catalog("Adventure Works DW 2008R2")
.Cube("Adventure Works"))
.Read("https://demos.telerik.com/olap/msmdpump.dll")
)
)
)
DataSource(System.String)
Sets an existing DataSource as a DataSource of the PivotGridV2.
Parameters
dataSourceId - System.String
The name of the existing DataSource.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.DataSource("externalDS")
)
Configurator(System.String)
Defines the PivotConfiguratorV2.
Parameters
configurator - System.String
The Name() option of the PivotConfiguratorV2.
Example
@(Html.Kendo().PivotConfiguratorV2()
.Name("configurator")
.Sortable()
.Filterable()
.Height(570)
)
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.Configurator("#configurator")
)
BindTo(System.Collections.Generic.IEnumerable)
Binds the PivotGridV2 to a collection of objects (local data).
Parameters
dataSource - System.Collections.Generic.IEnumerable<TModel>
The IEnumerable collection that contains the data.
Example
@model IEnumerable<ProductViewModel>
@(Html.Kendo().PivotGridV2<ProductViewModel>()
.Name("pivotgrid")
.BindTo(Model)
)
Excel(System.Action)
Configures the PivotGridV2 Excel export settings.
Parameters
configurator - System.Action<PivotGridV2ExcelSettingsBuilder>
The action that configures the Excel export settings.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.Excel(excel => excel.FileName("Report.xlsx").Filterable(true))
)
KpiStatusTemplate(System.String)
Defines the template that renders the content of the KPI Status value. By default, the KPI Status value is rendered through "open", "hold" and "denied" status icons. The available fields in the template are: - columnTuple: The tuple of the corresponding column header cell. - rowTuple: The tuple of the corresponding row header cell. - measure: The value of the data cell measure. - dataItem: The data item itself.
Parameters
value - System.String
The value that configures the template content.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.KpiStatusTemplate("#= dataItem.value >= 0 ? '<em>Open/Denied</em>' : '<strong>Hold</strong>'#")
)
KpiStatusTemplateId(System.String)
Defines the template that renders the content of the KPI Status value. By default, the KPI Status value is rendered through "open", "hold" and "denied" status icons. The available fields in the template are: - columnTuple: The tuple of the corresponding column header cell. - rowTuple: The tuple of the corresponding row header cell. - measure: The value of the data cell measure. - dataItem: The data item itself.
Parameters
templateId - System.String
The "id" of the external Kendo UI template.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.KpiStatusTemplateId("kpiStatusTemplate")
)
<script id="kpiStatusTemplate" type="text/x-kendo-template">
# if (dataItem.value >= 0) { #
<em>Open/Denied</em>
# } else { #
<strong>Hold</strong>
# } #
</script>
KpiStatusTemplateView(System.Web.Mvc.MvcHtmlString)
Defines the template that renders the content of the KPI Status value. By default, the KPI Status value is rendered through "open", "hold" and "denied" status icons. The available fields in the template are: - columnTuple: The tuple of the corresponding column header cell. - rowTuple: The tuple of the corresponding row header cell. - measure: The value of the data cell measure. - dataItem: The data item itself.
Parameters
value - System.Web.Mvc.MvcHtmlString
The Razor View that will render the template content.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.KpiStatusTemplateView(Html.Partial("KPIStatusTemplateView"))
)
KpiStatusTemplateHandler(System.String)
Defines the template that renders the content of the KPI Status value. By default, the KPI Status value is rendered through "open", "hold" and "denied" status icons. The available fields in the template are: - columnTuple: The tuple of the corresponding column header cell. - rowTuple: The tuple of the corresponding row header cell. - measure: The value of the data cell measure. - dataItem: The data item itself.
Parameters
templateHandler - System.String
The JavaScript function that will return the template content.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.KpiStatusTemplateHandler("getKPIStatusTemplate")
)
<script>
function getKPIStatusTemplate(data) {
if(data.dataItem.value >= 0) {
return `<em>Open/Denied</em>`;
} else {
return `<strong>Hold</strong>`;
}
}
</script>
KpiStatusTemplate(Kendo.Mvc.UI.TemplateBuilder)
Defines the template that renders the content of the KPI Status value. By default, the KPI Status value is rendered through "open", "hold" and "denied" status icons. The available fields in the template are: - columnTuple: The tuple of the corresponding column header cell. - rowTuple: The tuple of the corresponding row header cell. - measure: The value of the data cell measure. - dataItem: The data item itself.
Parameters
template - TemplateBuilder<T>
A Template component that configures the template content.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.KpiStatusTemplate(Html.Kendo().Template().AddHtml("<strong>${data.dataItem.value}</strong>"))
)
KpiTrendTemplate(System.String)
Defines the template that renders the content of the KPI Trend value. By default, the KPI Trend value is rendered through "increase", "decrease" and "equal" status icons. The available fields in the template are: - columnTuple: The tuple of the corresponding column header cell. - rowTuple: The tuple of the corresponding row header cell. - measure: The value of the data cell measure. - dataItem: The data item itself.
Parameters
value - System.String
The value that configures the template content.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.KpiTrendTemplate("#= dataItem.value >= 0 ? '<em>Increase/Decrease</em>' : '<strong>Equal</strong>'#")
)
KpiTrendTemplateId(System.String)
Defines the template that renders the content of the KPI Trend value. By default, the KPI Trend value is rendered through "increase", "decrease" and "equal" status icons. The available fields in the template are: - columnTuple: The tuple of the corresponding column header cell. - rowTuple: The tuple of the corresponding row header cell. - measure: The value of the data cell measure. - dataItem: The data item itself.
Parameters
templateId - System.String
The "id" of the external Kendo UI template.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.KpiTrendTemplateId("kpiTrendTemplate")
)
<script id="kpiTrendTemplate" type="text/x-kendo-template">
# if (dataItem.value >= 0) { #
<em>Increase/Decrease</em>
# } else { #
<strong>Equal</strong>
# } #
</script>
KpiTrendTemplateView(System.Web.Mvc.MvcHtmlString)
Defines the template that renders the content of the KPI Trend value. By default, the KPI Trend value is rendered through "increase", "decrease" and "equal" status icons. The available fields in the template are: - columnTuple: The tuple of the corresponding column header cell. - rowTuple: The tuple of the corresponding row header cell. - measure: The value of the data cell measure. - dataItem: The data item itself.
Parameters
value - System.Web.Mvc.MvcHtmlString
The Razor View that will render the template content.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.KpiTrendTemplateView(Html.Partial("KPITrendTemplateView"))
)
KpiTrendTemplateHandler(System.String)
Defines the template that renders the content of the KPI Trend value. By default, the KPI Trend value is rendered through "increase", "decrease" and "equal" status icons. The available fields in the template are: - columnTuple: The tuple of the corresponding column header cell. - rowTuple: The tuple of the corresponding row header cell. - measure: The value of the data cell measure. - dataItem: The data item itself.
Parameters
templateHandler - System.String
The JavaScript function that will return the template content.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.KpiTrendTemplateHandler("getKPITrendTemplate")
)
<script>
function getKPITrendTemplate(data) {
if(data.dataItem.value >= 0) {
return `<em>Increase/Decrease</em>`;
} else {
return `<strong>Equal</strong>`;
}
}
</script>
KpiTrendTemplate(Kendo.Mvc.UI.TemplateBuilder)
Defines the template that renders the content of the KPI Trend value. By default, the KPI Trend value is rendered through "increase", "decrease" and "equal" status icons. The available fields in the template are: - columnTuple: The tuple of the corresponding column header cell. - rowTuple: The tuple of the corresponding row header cell. - measure: The value of the data cell measure. - dataItem: The data item itself.
Parameters
template - TemplateBuilder<T>
A Template component that configures the template content.
Example
@(Html.Kendo().PivotGridV2()
.Name("pivotgrid")
.KpiTrendTemplate(Html.Kendo().Template().AddHtml("<strong>${data.dataItem.value}</strong>"))
)
ToComponent()
Returns the internal view component.
Name(System.String)
Sets the name of the component.
Parameters
componentName - System.String
The name of the component.
Example
@(Html.Kendo().Grid<OrderViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.OrderID).Filterable(false);
columns.Bound(p => p.Freight);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.Read(read => read.Action("Orders_Read", "Grid"))
)
)
Deferred(System.Boolean)
Suppress initialization script rendering. Note that this options should be used in conjunction with
Parameters
deferred - System.Boolean
ModelMetadata(System.Web.Mvc.ModelMetadata)
Uses the Metadata of the Model.
Parameters
modelMetadata - System.Web.Mvc.ModelMetadata
The metadata set for the Model
HtmlAttributes(System.Object)
Sets the HTML attributes.
Parameters
attributes - System.Object
The HTML attributes.
HtmlAttributes(System.Collections.Generic.IDictionary)
Parameters
attributes - System.Collections.Generic.IDictionary<String,Object>
AsModule(System.Boolean)
Specifies whether the initialization script of the component will be rendered as a JavaScript module.
Parameters
value - System.Boolean
Render()
Renders the component.
Example
@(@Page Inherits="System.Web.Mvc.ViewPage<IEnumerable<Product>>" )
@( Html.Kendo().Grid(Model)
.Name("grid")
.DetailTemplate(product => {
)
Product Details:
<div>Product Name: @( product.ProductName )</div>
<div>Units In Stock: @( product.UnitsInStock )</div>
@(
})
.Render();
)
ScriptAttributes(System.Object,System.Boolean)
Sets the JavaScript attributes to the initialization script.
Parameters
attributes - System.Object
The JavaScript attributes.
overrideAttributes - System.Boolean
Argument which determines whether attributes should be overriden.
ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)
Sets the JavaScript attributes to the initialization script.
Parameters
attributes - System.Collections.Generic.IDictionary<String,Object>
The JavaScript attributes.
overrideAttributes - System.Boolean
Argument which determines whether attributes should be overriden.