@@ -6,7 +6,7 @@ import { compileGetter } from '@js/core/utils/data';
66import { Deferred , when } from '@js/core/utils/deferred' ;
77import { extend } from '@js/core/utils/extend' ;
88import { captionize } from '@js/core/utils/inflector' ;
9- import { isDefined , isFunction } from '@js/core/utils/type' ;
9+ import { isBoolean , isDefined , isFunction } from '@js/core/utils/type' ;
1010import formatHelper from '@js/format_helper' ;
1111import filterUtils from '@js/ui/shared/filtering' ;
1212import errors from '@js/ui/widget/ui.errors' ;
@@ -54,8 +54,21 @@ const FILTER_BUILDER_ITEM_TEXT_PART_CLASS = `${FILTER_BUILDER_ITEM_TEXT_CLASS}-p
5454const FILTER_BUILDER_ITEM_TEXT_SEPARATOR_CLASS = `${ FILTER_BUILDER_ITEM_TEXT_CLASS } -separator` ;
5555const FILTER_BUILDER_ITEM_TEXT_SEPARATOR_EMPTY_CLASS = `${ FILTER_BUILDER_ITEM_TEXT_SEPARATOR_CLASS } -empty` ;
5656
57- function getFormattedValueText ( field , value ) {
57+ function getFormattedValueText ( field , value ) : string {
5858 const fieldFormat = field . format || DEFAULT_FORMAT [ field . dataType ] ;
59+
60+ if ( isBoolean ( value ) ) {
61+ const trueText : string = field . trueText || messageLocalization . format ( 'dxDataGrid-trueText' ) ;
62+ const falseText : string = field . falseText || messageLocalization . format ( 'dxDataGrid-falseText' ) ;
63+
64+ return value ? trueText : falseText ;
65+ }
66+
67+ if ( field . dataType === 'date' || field . dataType === 'datetime' ) {
68+ // value can be string or number, we need to convert it to Date object
69+ return formatHelper . format ( new Date ( value ) , fieldFormat ) ;
70+ }
71+
5972 return formatHelper . format ( value , fieldFormat ) ;
6073}
6174
@@ -562,21 +575,16 @@ export function getCurrentLookupValueText(field, value, handler) {
562575}
563576
564577function getPrimitiveValueText ( field , value , customOperation , target , options ?) {
565- let valueText ;
566- if ( value === true ) {
567- valueText = field . trueText || messageLocalization . format ( 'dxDataGrid-trueText' ) ;
568- } else if ( value === false ) {
569- valueText = field . falseText || messageLocalization . format ( 'dxDataGrid-falseText' ) ;
570- } else {
571- valueText = getFormattedValueText ( field , value ) ;
572- }
578+ let valueText = getFormattedValueText ( field , value ) ;
579+
573580 if ( field . customizeText ) {
574581 valueText = field . customizeText . call ( field , {
575582 value,
576583 valueText,
577584 target,
578585 } ) ;
579586 }
587+
580588 if ( customOperation && customOperation . customizeText ) {
581589 valueText = customOperation . customizeText . call ( customOperation , {
582590 value,
@@ -585,6 +593,7 @@ function getPrimitiveValueText(field, value, customOperation, target, options?)
585593 target,
586594 } , options ) ;
587595 }
596+
588597 return valueText ;
589598}
590599
0 commit comments