Kendo UI- MVC grid and Multi filtering

14 posts, 0 answers
  1. Dinesh
    Dinesh avatar
    3 posts
    Member since:
    Oct 2014

    Posted 23 Apr 2015 Link to this post

    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

  2. Daniel
    Admin
    Daniel avatar
    2166 posts

    Posted 27 Apr 2015 Link to this post

    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.

     
  3. Dinesh
    Dinesh avatar
    3 posts
    Member since:
    Oct 2014

    Posted 04 May 2015 in reply to Daniel Link to this post

    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
  4. Daniel
    Admin
    Daniel avatar
    2166 posts

    Posted 06 May 2015 Link to this post

    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.

     
  5. Saquib
    Saquib avatar
    18 posts
    Member since:
    Mar 2015

    Posted 10 Nov 2016 Link to this post

    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

  6. Daniel
    Admin
    Daniel avatar
    2166 posts

    Posted 14 Nov 2016 Link to this post

    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.
  7. Saquib
    Saquib avatar
    18 posts
    Member since:
    Mar 2015

    Posted 14 Nov 2016 in reply to Daniel Link to this post

    Thank you!

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

  8. Saquib
    Saquib avatar
    18 posts
    Member since:
    Mar 2015

    Posted 15 Nov 2016 in reply to Saquib Link to this post

    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

  9. Raj
    Raj avatar
    23 posts
    Member since:
    Nov 2016

    Posted 22 Mar Link to this post

    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

  10. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    282 posts

    Posted 24 Mar Link to this post

    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 visualization (charts) and form elements.
  11. Raj
    Raj avatar
    23 posts
    Member since:
    Nov 2016

    Posted 28 Mar Link to this post

    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.

  12. Stefan
    Admin
    Stefan avatar
    912 posts

    Posted 30 Mar Link to this post

    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 visualization (charts) and form elements.
  13. Raj
    Raj avatar
    23 posts
    Member since:
    Nov 2016

    Posted 20 Apr in reply to Stefan Link to this post

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

    Thanks

    Raj

  14. Stefan
    Admin
    Stefan avatar
    912 posts

    Posted 24 Apr Link to this post

    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 visualization (charts) and form elements.
Back to Top