Null value in date field: "null" appears, I want to show empty or custom text

7 posts, 0 answers
  1. Dave
    Dave avatar
    10 posts
    Member since:
    Nov 2015

    Posted 12 Jan 2016 Link to this post

    Hello,

    I have a TreeList with a nullable date field to be displayed.  The following line adds the field to my Treelist:

        columns.Add().Field(e => e.LastUsed).Format("{0:MMMM d, yyyy}"); 

    If the date field has a value, then the date is displayed.  If it is null, the word "null" is displayed.  I would like to be able to display either a custom text string like "N/A" or a blank, instead of the word "null".

    I also don't want to convert the Treelist to all javascript. 

    Thank you very much for your assistance.

    Dave

  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1444 posts

    Posted 14 Jan 2016 Link to this post

    Hi Dave,

    This can be done using a column template that checks the value and renders different text accordingly. For example: 
    "#if(myField === null){# N/A #}else{# #=myField#  #}#"

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Dave
    Dave avatar
    10 posts
    Member since:
    Nov 2015

    Posted 22 Jan 2016 in reply to Alexander Popov Link to this post

    Hi Alexander,

    Sorry for the delay in replying back to you.  Thanks for providing a solution.  I appreciate it.  Have a nice day...

    Dave

  4. Chris
    Chris avatar
    119 posts
    Member since:
    Oct 2015

    Posted 04 Jan 2018 in reply to Alexander Popov Link to this post

    null to "" (not "null") should handle by component directly, right ? null to "" - handle by programmer is not reasonable in physical implementation.

     

    Best regards

     

    Chris

     

     

  5. Stefan
    Admin
    Stefan avatar
    2913 posts

    Posted 08 Jan 2018 Link to this post

    Hello, Chris,

    Thank you for the feedback.

    Could you please advise how would you expect the null values to be shown by the Kendo UI TreeList by default? This will help us discuss the approach and advise if it is applicable in the widget.

    Thank you in advance.

    Regards,
    Stefan
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  6. Chris
    Chris avatar
    119 posts
    Member since:
    Oct 2015

    Posted 08 Jan 2018 in reply to Stefan Link to this post

    Not only TreeList, I think all components(ex. TextBox,etc.) should default show empty("") while the value is null. 

     

    Best regards

     

    Chris

     

     

  7. Stefan
    Admin
    Stefan avatar
    2913 posts

    Posted 10 Jan 2018 Link to this post

    Hello, Chris,

    For now, displaying null is the default behavior and changing it will cause a breaking change in the widgets.

    If the Kendo UI community thinks that displaying empty string by default is a better behavior please submit a feature request in our feedback portal and based on its popularity we may implement it in a future release:

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


    Regards,
    Stefan
    Progress Telerik
    Try our brand new, jQuery-free Angular 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