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

Kendo UI- MVC grid and Multi filtering

13 Answers 1042 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dinesh
Top achievements
Rank 1
Dinesh asked on 23 Apr 2015, 04:07 PM

I have a grid which has just one colomn [RoleName] with filtering, multi-filtering enable and it is bound to a data source (Role object- it contains RoleName and RoleID). When the filter renders it displays RoleName. Is there any way that i could change checkbox value to role-ID While the filters still displays RoleName.

@(Html.Kendo().Grid<Keymaster.Models.UserRoleModel>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(c => c.UserID).Width(140).Filterable(false);
            columns.Bound(c => c.FirstName).Width(140).Filterable(false);
            columns.Bound(c => c.LastName).Width(140).Filterable(false);
            columns.Bound(c => c.Role).Width(140).Filterable(f => f.Multi(true).UI("").DataSource(source => source.Read(r => r.Action("GetRolesForGrid", "UserActivityByRoles"))));
            columns.Bound(c => c.Location).Width(140).Filterable(false);
            columns.Bound(c => c.LastLogin).Width(140).Filterable(false);
        })
                .HtmlAttributes(new { style = "height:500px;width:60%;align:center;margin:0 auto" })
        .Scrollable()
        .Sortable()
        .Mobile()
        .Filterable()
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true)
            .ButtonCount(5))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("GetRolesForGridForDisplay", "UserActivityByRoles"))
        )
)

img 

 

 

Thanks,

Dinesh B

13 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 27 Apr 2015, 11:48 AM
Hello,

You can use an itemTemplate in order to set the checkboxes value to RoleID and display RoleName e.g.
.Filterable(f => f.Multi(true).UI("").DataSource(source => source.Read(r => r.Action("GetRolesForGrid", "UserActivityByRoles"))).ItemTemplate("roleTemplate"));
function roleTemplate(e) {
    return '<li><label class="k-label"><input type="checkbox" value="#:data.RoleID#" />#:data.RoleName || data.all#</label></li>';
}


Regards,
Daniel
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Dinesh
Top achievements
Rank 1
answered on 04 May 2015, 04:39 PM
Cool, works well. But Instead of Check box, I was trying to use Radio Button but the filter never triggers the action method "GetRolesForGrid". Is there any i can replace checkbox with radio button
0
Daniel
Telerik team
answered on 06 May 2015, 03:15 PM
Hello again,

I am afraid that radio buttons are not supported. The filter menu will search for checkboxes and so no filter values will be found when using radio buttons.

Regards,
Daniel
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Saquib
Top achievements
Rank 1
answered on 10 Nov 2016, 02:49 PM

I cannot find "Search" in column filter. This line errors out on Search(true).

columns.Bound(c => c.ColumnName).Title("Column Name").Filterable(f => f.Multi(true).Search(true).DataSource(ds => ds.Read(r => r.Action("actionname", "controllername"))));

 

Can you please let me know

 

Thanks

0
Daniel
Telerik team
answered on 14 Nov 2016, 08:21 AM
Hello,

Which version are you using? The option is available since the R1 2016(2016.1.112) release. 

Regards,
Daniel
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
0
Saquib
Top achievements
Rank 1
answered on 14 Nov 2016, 02:43 PM

Thank you!

I am using Version - 2015.1 408. I will upgrade and see how it works.

0
Saquib
Top achievements
Rank 1
answered on 15 Nov 2016, 03:34 PM

It worked great after upgrading to version: 2016.3.1028. I had to update these files 

1. The kendo.Mvc dll
2. The script files kendo.all.min.js and kendo.aspnetmvc.min.js 
3. The style files kendo.bootstrap.min.css and kendo.common.min.css
4. All the Images in Bootstrap folder

5. KendoUIGlyphs.ttf and KendoUIGlyphs.woff files in fonts folder

 

Thanks

0
Raj
Top achievements
Rank 1
answered on 22 Mar 2017, 07:39 PM

How do i Filter if a column cell has one or more values that are in filter list. In the attached images you can see QaQcComment has both MIN Base Type Code, Used DMR Data that are in the filter menu. If i filter any one or both of MIN Base Type Code, Used DMR Data from filter menu, grid is not filtering. How can i do that?

Thanks

Raj

0
Alex Hajigeorgieva
Telerik team
answered on 24 Mar 2017, 03:32 PM
Hi Raj,

Can you confirm if you are using server operations? Is it possible that the Kendo UI Grid is filtering but the performance is poor?

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.filterable.multi

You could test by providing a separate data source for the checkboxes. Here is a simple JavaScript example:

http://dojo.telerik.com/oGuhah

If this is not the case, could you elaborate on the current behaviour and the desired outcome so I can advise accordingly? Alternatively, please modify the provided Dojo along with a brief explanation/steps to reproduce the Kendo UI multi-check filterable Grid not filtering?
Regards,
Alex Hajigeorgieva
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
0
Raj
Top achievements
Rank 1
answered on 28 Mar 2017, 03:15 PM

Yes i am Using Server Operations to get the grid filter menu options and also filter is working if the column has values that are same in the filter options. But if there are more than one values in the column separated by a comma then that column is not getting filtered. please go through the Images i have provided in my previous post.

You can see QaQcComment Column in grid has both MIN Base Type Code, Used DMR Data separated by a comma (FYI in capture.png)

If you see in the filter options there are both Base Type Code, Used DMR Data as separate Check boxes, Now if i filter by MIN Base Type Code check Box Value I am not getting the rows that you can see in capture.png Image

Also Im attaching a new Image(OtherRows.Png) that shows the other rows with other QaQcComment column values which works fine when filtered.

0
Stefan
Telerik team
answered on 30 Mar 2017, 10:28 AM
Hello Raj,

This scenario is not supported out of the box by the Kendo UI Grid.

Once a value is selected from the filter menu, the Grid is searching for a direct match which is not found.

This can be only done using a custom filtering logic on the server as the Grid will send a filter operator equal, which have to be replaced with contains on the server, and then the server should return all of the items which contain the chosen value.

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
0
Raj
Top achievements
Rank 1
answered on 20 Apr 2017, 05:06 PM

Can you provide a sample code that overrides the filter operator 'Isequalto' to 'Contains' When used Multi Checkboxes?

Thanks

Raj

0
Stefan
Telerik team
answered on 24 Apr 2017, 08:07 AM
Hello Raj,

As mentioned in the previous reply the Grid will send the request with the equal operator, and this behaviour cannot be modified from the Grid, the operator logic can be changed only programmatically on the server.

I can suggest submitting a feature request to changed the filter operator when the checkbox filtering is used:

http://kendoui-feedback.telerik.com/forums/127393-kendo-ui-feedback/category/170280-grid

Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
Tags
Grid
Asked by
Dinesh
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Dinesh
Top achievements
Rank 1
Saquib
Top achievements
Rank 1
Raj
Top achievements
Rank 1
Alex Hajigeorgieva
Telerik team
Stefan
Telerik team
Share this question
or