Custom bool filter and advanced filter questions

15 posts, 0 answers
  1. Giovanni
    Giovanni avatar
    37 posts
    Member since:
    Feb 2011

    Posted 05 Feb 2013 Link to this post

    Hello,
    I'm trying to setup a custom filter for boolean. Is it possible? For the other filter types I have no problem, but for boolean filter I can't set up my UI widget. This is my code for filter set up:

    filterable:
    {
    ui: function(element)
    {
    element.kendoDropDownList({
    dataSource: new kendo.data.DataSource({
    data: [
    {text:"True", value:true},
    {text:"False", value:false}
    ]}),
    dataTextField: "text",
    dataValueField: "value"
    });
    }
    }

    I would like to have a dropdown with the two value, "True" or "False". I don't have any errors, but the custom filter is not displayed.
    Moreover I have also another couple of questions:

    1) Is it possible to remove the "Or" logical operator from the dropdown? I would like to have only the "And" operator.
    2) Is it possible to remove the "extra" field from only one filter? If I setup "extra:true" all the filters have the extra options.

    Thanks
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 07 Feb 2013 Link to this post

    Hello Giovanni,

    Thank you for getting in touch with us. Straight to your questions:

    I'm trying to setup a custom filter for boolean. Is it possible?
    This is not possible - by design boolean fields does not support filter customization (you can only change the labels of radio buttons). The main obstacle is that this filter menu uses checked binding while the other filter inputs use value binding. Checked binding works with check boxes/radio buttons only, the DropDownList is a select element.

    1) Is it possible to remove the "Or" logical operator from the dropdown? I would like to have only the "And" operator
    I am afraid that this is currently not possible through the configuration options. The only possible solution is to find the corresponding DropDownList widget and remote the "Or" option from its DataSource.

    2) Is it possible to remove the "extra" field from only one filter? If I setup "extra:true" all the filters have the extra options.
    Yes, you can set extra: false to a single column only. 
    { field: "name", filterable: { extra: false } },

    Regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Alexander
    Alexander avatar
    19 posts
    Member since:
    Jun 2012

    Posted 04 Apr 2013 Link to this post

    " (you can only change the labels of radio buttons)."

    Is there documentation on how to do this? I'm trying to get the filter radio button labels to match the template strings applied to my boolean field.
  5. Nikolajs
    Nikolajs avatar
    2 posts
    Member since:
    Jan 2013

    Posted 05 Apr 2013 Link to this post

    @(Html.Kendo().Grid<EntityName>()
            .Name("GridName")
            .Columns(columns =>
            {
                columns.Bound(c => c.HasEditingRights);
            })
            .Filterable(filterable =>filterable.Messages(m=>m.IsFalse("No"))
               .Messages(m=>m.IsTrue("Yes")))
    )
    For bool filter's labels try this approach.
  6. Alexander
    Alexander avatar
    19 posts
    Member since:
    Jun 2012

    Posted 05 Apr 2013 Link to this post

    Thanks Nikolajs, I was looking for a way to do it client-side with Kendo UI Web. Your response helped me though! In case anyone else wonders about this, here's how to do it:

    $().kendoGrid({
    columns: [ { field: "FieldName", title: "FieldTitle", template: kendo.template('#= FieldName ? "trueString" : "falseString" #'), filterable: { messages: { isTrue: "trueString", isFalse: "falseString" } } }
    ]
    });
  7. Stefan
    Stefan avatar
    8 posts
    Member since:
    Aug 2011

    Posted 15 Oct 2015 in reply to Alexander Valchev Link to this post

    Hi Alexander,

    Just wondering if it is now possible to create a custom filter for boolean? If not, is there a different way to filter nullable booleans? The filter currently defaults to the "is true / is false", but no option for neither (null).

    Thanks,
    Stefan.

  8. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 19 Oct 2015 Link to this post

    Hi Stefan,

    Null filtering is not supported at present. This is a top feature request at Kendo UI feedback portal and will be implemented in Q1 2016 release which is due to be published in January 2016.

    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  9. Stefan
    Stefan avatar
    8 posts
    Member since:
    Aug 2011

    Posted 19 Oct 2015 in reply to Alexander Valchev Link to this post

    Awesome, looking forward to it!

    Thanks.

  10. Skip
    Skip avatar
    4 posts
    Member since:
    Aug 2011

    Posted 26 Jan in reply to Alexander Valchev Link to this post

    It certainly would be helpful if the API documentation mentioned this.
  11. Skip
    Skip avatar
    4 posts
    Member since:
    Aug 2011

    Posted 26 Jan in reply to Skip Link to this post

    (that's in reference to the earlier comment that filter customization is not supported on Boolean columns --- I clicked "reply" to that message, but it still put my message at the end)
  12. Skip
    Skip avatar
    4 posts
    Member since:
    Aug 2011

    Posted 26 Jan in reply to Skip Link to this post

    jeez ... apparently the link embedding doesn't work either .... I'm referring to this documentation:
    http://docs.telerik.com/KENDO-UI/api/javascript/ui/grid#configuration-columns.filterable.ui
  13. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 28 Jan Link to this post

    Hello Skip,

    New operators are documented in filterable.operators.[string/number/date/enum] section

    • http://docs.telerik.com/KENDO-UI/api/javascript/ui/grid#configuration-filterable.operators.string.isnull
    • http://docs.telerik.com/KENDO-UI/api/javascript/ui/grid#configuration-filterable.operators.string.isnotnull
    • http://docs.telerik.com/KENDO-UI/api/javascript/ui/grid#configuration-filterable.operators.string.isempty
    • http://docs.telerik.com/KENDO-UI/api/javascript/ui/grid#configuration-filterable.operators.string.isnotempty
    • //etc.


    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  14. Skip
    Skip avatar
    4 posts
    Member since:
    Aug 2011

    Posted 28 Jan in reply to Alexander Valchev Link to this post

    Hi Alexander,

    My comment was in regard to your response on Feb 7 2013:

    I'm trying to setup a custom filter for boolean. Is it possible?
    This is not possible - by design boolean fields does not support filter customization

     

    When creating a custom filter, you would be utilizing the UI property of the column's filterable setting, as documented here:
    http://docs.telerik.com/KENDO-UI/api/javascript/ui/grid#configuration-columns.filterable.ui

    That documentation makes no mention of the fact that creating a custom filter for a Boolean column is not possible.
    When you attempt to do so, it simply does not work.  
    There is no error, it simply does not work.

    That's why I think it would be helpful if the documentation of the UI property mentioned this.

  15. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 01 Feb Link to this post

    Hello Skip,

     

    Thank you for your feedback, indeed we will update the article. 

     

    Regards,
    Boyan Dimitrov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  16. Scott Waye
    Scott Waye avatar
    111 posts
    Member since:
    Nov 2009

    Posted 25 Feb in reply to Boyan Dimitrov Link to this post

    If you get to the bottom here and are disappointed, you can vote for this feature: http://kendoui-feedback.telerik.com/forums/127393-telerik-kendo-ui-feedback/suggestions/12477711-bool
Back to Top
Kendo UI is VS 2017 Ready