超链接列上的 Syncfusion mvc 网格控件过滤
Syncfusion mvc grid control filtering on hyperlink column
我刚刚尝试了 mvc 的 syncfusion 控件,但遇到了一些障碍。我的问题是,当我使用列模板功能在 ej 网格列中使用 hyperlink 时,过滤器对该列不起作用。我当前的 UI 是这样设计的,我需要将列值呈现为可点击 link 并且我还需要允许根据该列中的值进行过滤。
要执行过滤、排序、分组等操作,必须为列启用字段。将根据列值执行上述操作。要在模板列中执行过滤,请将 Field 属性 定义到模板列。
参考下面的代码示例
@(Html.EJ().Grid<EmployeeView>("ColumnTemplate")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.AllowPaging()
.ToolbarSettings(toolBar => toolBar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.ExcelExport);
items.AddTool(ToolBarItems.WordExport);
items.AddTool(ToolBarItems.PdfExport);
}))
.Columns(col =>
{
col.HeaderText("First Name").Field(“FirstName”).Template("#columnTemplate").TextAlign(TextAlign.Center).Width(80).Add();
col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(100).Add();
col.Field("LastName").HeaderText("Last Name").Width(100).Add();
col.Field("BirthDate").HeaderText("Birth Date").TextAlign(TextAlign.Right).Width(100).Format("{0:MM/dd/yyyy}").Add();
col.Field("Country").Width(100).HeaderText("Country").Add();
})
)
如果您有进一步的疑问,请回复我们。
我刚刚尝试了 mvc 的 syncfusion 控件,但遇到了一些障碍。我的问题是,当我使用列模板功能在 ej 网格列中使用 hyperlink 时,过滤器对该列不起作用。我当前的 UI 是这样设计的,我需要将列值呈现为可点击 link 并且我还需要允许根据该列中的值进行过滤。
要执行过滤、排序、分组等操作,必须为列启用字段。将根据列值执行上述操作。要在模板列中执行过滤,请将 Field 属性 定义到模板列。
参考下面的代码示例
@(Html.EJ().Grid<EmployeeView>("ColumnTemplate")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.AllowPaging()
.ToolbarSettings(toolBar => toolBar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.ExcelExport);
items.AddTool(ToolBarItems.WordExport);
items.AddTool(ToolBarItems.PdfExport);
}))
.Columns(col =>
{
col.HeaderText("First Name").Field(“FirstName”).Template("#columnTemplate").TextAlign(TextAlign.Center).Width(80).Add();
col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(100).Add();
col.Field("LastName").HeaderText("Last Name").Width(100).Add();
col.Field("BirthDate").HeaderText("Birth Date").TextAlign(TextAlign.Right).Width(100).Format("{0:MM/dd/yyyy}").Add();
col.Field("Country").Width(100).HeaderText("Country").Add();
})
)
如果您有进一步的疑问,请回复我们。