abp icon indicating copy to clipboard operation
abp copied to clipboard

Handle null values on Datatables `Date` data formats

Open cotur opened this issue 5 years ago • 2 comments

image

cotur avatar Apr 15 '21 13:04 cotur

Will only consider time format? Is there a case where there is an object attribute?

E.g:blog.writer.name? If the Writer here is null?

jonny-xhl avatar Apr 29 '21 16:04 jonny-xhl

Hi @jonny-xhl

We made this update for date & datetime datetable format extensions for abp.

Example:

{
                title: l("LastModificationTime"),
                orderable: true,
                data: 'lastModificationTime',
                dataFormat: "datetime"
            }

In your case, you can use render option to handle different scenarios for your object.

Example:

{
                title: "MyTitle",
                data: "myProperty",
                render: function(myProperty){

                if(!myProperty) { return "not-exist"; }
                
                return myProperty;
                }
            }

cotur avatar Apr 29 '21 18:04 cotur