Multi Filterable with client template

2 posts, 0 answers
  1. Marc
    Marc avatar
    66 posts
    Member since:
    Jul 2010

    Posted 19 Oct Link to this post

    Can I please get an example of how to use the multi-filter option (.Filterable(f => f.Multi(true))) when the column is using a ClientTemplate.

     

    WIth the code below I get [Object] [Object] in the column filter drop down. The client template is parse out an array of hyperlinks from the model.

     

     

    columns.Bound(e => e.Reports).Title("Open <br />Reports").Filterable(f => f.Multi(true)).Width(120).ClientTemplate("#=openReport(Reports)#");

     

       function openReports(Reports) {
            if (Reports && Reports.length > 0) {
                var result = "";
                var j = Reports.length;
                for (var i = 0; i < j; i++) {
                    result += "<a href='" +
                        someServer +
                        "webpage.aspx?someNumber=" +
                         Reports[i].Number +
                        "&Revision=" +
                        Reports[i].Revision +
                        "' target ='_blank'>" +
                        + Reports[i].Number +
                        "-" +
                        Reports[i].Revision +
                        "</a>, ";
                }
                return result.substring(0, result.length - 2);
            } else {
                return "";
            }

        }

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 21 Oct Link to this post

    Hello Marc,

    The issue that you are experiencing is due to the fact that the column in question is bound to a complex object and filtering is not supported in such scenario. The multi checkbox filtering is supported when the column is bound to a field containing values that could be filtered, which is not the case with complex objects. If you need to enable the filtering you should bound the column to one of the fields of your Reports property:
    columns.Bound(e => e.Reports.Number)  for example

    Hope this helps.


    Regards,
    Konstantin Dikov
    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.
  3. Kendo UI is VS 2017 Ready
Back to Top