Having trouble getting help?
Contact Support
Contact Support
Responsive Columns in ASP.NET MVC Tree Grid Component
21 Dec 20221 minute to read
You can toggle column visibility based on media queries which are defined at the HideAtMedia
.
The HideAtMedia
accepts valid
Media Queries.
@using Syncfusion.EJ2.Grids
@(Html.EJS().TreeGrid("ResponsiveColumns")
.DataSource((IEnumerable<object>)ViewBag.datasource)
.Columns(col =>
{
col.Field("TaskID").HeaderText("Task ID").Width(90).HideAtMedia("max-width: 700px").TextAlign(TextAlign.Right).Add();
col.Field("TaskName").HeaderText("Task Name").Width(180).Add();
col.Field("StartDate").HeaderText("Start Date").Format("yMd").TextAlign(TextAlign.Right).Width(120).Add();
col.Field("Duration").HeaderText("Duration").HideAtMedia("max-width: 500px").Width(80).TextAlign(TextAlign.Right).Add();
}).Height(315).ChildMapping("Children").TreeColumnIndex(1).Render()
)
public ActionResult ResponsiveColumns()
{
var treeData = TreeGridItems.GetTreeData();
ViewBag.datasource = treeData;
return View();
}
NOTE
You can refer to our
ASP.NET MVC Tree Grid
feature tour page for its groundbreaking feature representations. You can also explore ourASP.NET MVC Tree Grid example
to knows how to present and manipulate data.