This is a migrated thread and some comments may be shown as answers.

default boolean filter

1 Answer 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jerry
Top achievements
Rank 1
Jerry asked on 09 Apr 2014, 03:23 AM
Hi there,

I want to add a default filter to a boolean column in the grid. Could you tell me how to do it?

@(Html.Kendo()
.Grid<Client.Website.Models.ClientModel>()
.Name("ClientGrid")
            .HtmlAttributes(new { style = "height:100%; clear:both;table-layout: fixed;" })
            .Columns(columns =>
            {
                columns.Bound(c => c.ClientId).Hidden();
                columns.Bound(c => c.Name);
                columns.Bound(c => c.IsActive).Width(80).Filterable(filter=>filter.Enabled(true));
                columns.Bound(c => c.Notes)})
            .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("GetClients", "Client"))
                    )
            .Scrollable()
            .Pageable()
            .Sortable()
            .Selectable()
            .Filterable())

Thank you


regards
Jerry

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 09 Apr 2014, 12:08 PM
Hello Jerry,

The filters are specified in the DataSource. For example: 
.DataSource(dataSource => dataSource       
    .Ajax()        
    .Filter(f=>f.Add(p=>p.isActive).IsEqualTo(true))


Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Jerry
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or