@@ -97,16 +97,28 @@ export class GridClientSideComponent implements OnInit {
97
97
} ,
98
98
{ id : 'utcDate' , name : 'UTC Date' , field : 'utcDate' , formatter : Formatters . dateTimeIsoAmPm , sortable : true , minWidth : 115 ,
99
99
type : FieldType . dateUtc , outputType : FieldType . dateTimeIsoAmPm , filterable : true , filter : { model : Filters . compoundDate } } ,
100
- { id : 'effort-driven' , name : 'Effort Driven' , field : 'effortDriven' , minWidth : 85 , maxWidth : 85 , formatter : Formatters . checkmark ,
100
+ {
101
+ id : 'effort-driven' , name : 'Effort Driven' , field : 'effortDriven.isEffort' , minWidth : 85 , maxWidth : 85 ,
101
102
type : FieldType . boolean ,
102
103
sortable : true ,
104
+
105
+ // to pass multiple formatters, use the params property
106
+ // also these formatters are executed in sequence, so if you want the checkmark to work correctly, it has to be the last formatter defined
107
+ formatter : Formatters . multiple ,
108
+ params : { formatters : [ Formatters . complexObject , Formatters . checkmark ] } ,
109
+
110
+ // when the "field" string includes the dot "." notation, the library will consider this to be a complex object and Filter accordingly
103
111
filterable : true ,
104
112
filter : {
105
113
// We can also add HTML text to be rendered (any bad script will be sanitized) but we have to opt-in, else it will be sanitized
106
114
// enableRenderHtml: true,
107
115
// collection: [{ value: '', label: '' }, { value: true, label: 'True', labelPrefix: `<i class="fa fa-check"></i> ` }, { value: false, label: 'False' }],
108
116
109
- collection : [ { value : '' , label : '' } , { value : true , label : 'True' } , { value : false , label : 'False' } ] ,
117
+ collection : [ { isEffort : '' , label : '' } , { isEffort : true , label : 'True' } , { isEffort : false , label : 'False' } ] ,
118
+ customStructure : {
119
+ value : 'isEffort' ,
120
+ label : 'label'
121
+ } ,
110
122
model : Filters . singleSelect ,
111
123
112
124
// we could add certain option(s) to the "multiple-select" plugin
@@ -162,6 +174,7 @@ export class GridClientSideComponent implements OnInit {
162
174
const randomPercent = randomBetween ( 0 , 100 ) ;
163
175
const randomHour = randomBetween ( 10 , 23 ) ;
164
176
const randomTime = randomBetween ( 10 , 59 ) ;
177
+ const randomIsEffort = ( i % 3 === 0 ) ;
165
178
166
179
tempDataset . push ( {
167
180
id : i ,
@@ -173,7 +186,10 @@ export class GridClientSideComponent implements OnInit {
173
186
start : ( i % 4 ) ? null : new Date ( randomYear , randomMonth , randomDay ) , // provide a Date format
174
187
usDateShort : `${ randomMonth } /${ randomDay } /${ randomYearShort } ` , // provide a date US Short in the dataset
175
188
utcDate : `${ randomYear } -${ randomMonthStr } -${ randomDay } T${ randomHour } :${ randomTime } :${ randomTime } Z` ,
176
- effortDriven : ( i % 3 === 0 )
189
+ effortDriven : {
190
+ isEffort : randomIsEffort ,
191
+ label : randomIsEffort ? 'Effort' : 'NoEffort' ,
192
+ }
177
193
} ) ;
178
194
}
179
195
0 commit comments