Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
105
How to initialize MVC Grid filter value?
posted

Can someone point me in the right direction? Using MVC, I have a web page that displays a grid with filters. I can manually filter records, however I would like to have one column (named "Active") to be filtered when the page loads as if the user had selected the filter Active = True. The page downloads all records (regardless of Active status) so that the user could chose to clear the filter and see all records without another roundtrip.

I looked through the online docs and samples but could not find where the specific MVC syntax for this is documented.

Below is what I have so far, but the filter initialization doesn't work and it displays all records.

Thanks in advance for your help.

@using Infragistics.Web.Mvc;

@model IQueryable<STRIPE_ASP461.EmployeeSummaryInfo>

@section Scripts {

<script type="text/javascript" src="@Url.Content("~/Scripts/Infragistics/js/infragistics.loader.js")"></script>

@(Html.Infragistics()

.Loader()

.ScriptPath(Url.Content("~/Scripts/Infragistics/js"))

.CssPath(Url.Content("~/Content/Infragistics/css"))

.Theme("infragistics")

.Render())

@(Html.Infragistics()

.Grid(Model)

.ID("igGrid")

.Width("600px")

.Height("800px")

.Caption("Employees")

.AutofitLastColumn(false)

.AutoGenerateColumns(false)

.Columns(column =>

{

column.For(x => x.LastName).HeaderText("Last Name").Width("150px");

column.For(x => x.FirstName).HeaderText("First Name").Width("150px");

column.For(x => x.EmployeeID).HeaderText("ID").Width("80px");

column.For(x => x.Active).HeaderText("Active").Width("50px");

})

.Features(f =>

{

f.ColumnMoving()

.Mode(MovingMode.Immediate);

f.Filtering()

.Type(OpType.Local)

.Mode(FilterMode.Simple)

.ColumnSettings(settings => {

settings.ColumnSetting() // Initially just show the Active records

.ColumnKey("Active")

.FilterCondition("true");

});

f.Hiding();

f.Paging()

.PageSize(20);

f.Resizing();

f.Responsive();

f.Selection()

.Mode(SelectionMode.Row);

f.Sorting()

.Mode(SortingMode.Multiple);

})

.RenderCheckboxes(true)

.DataBind()

.Render())

}

Parents Reply Children
No Data