@@ -97,16 +97,25 @@ export class GridClientSideComponent implements OnInit {
9797 } ,
9898 { id : 'utcDate' , name : 'UTC Date' , field : 'utcDate' , formatter : Formatters . dateTimeIsoAmPm , sortable : true , minWidth : 115 ,
9999 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+ { id : 'effort-driven' , name : 'Effort Driven' , field : 'effortDriven.isEffort ' , minWidth : 85 , maxWidth : 85 ,
101101 type : FieldType . boolean ,
102102 sortable : true ,
103103 filterable : true ,
104+ // to pass multiple formatters, use the params property
105+ // also these formatters are executed in sequence, so if you want the checkmark to work correctly, it has to be the last formatter defined
106+ formatter : Formatters . multiple ,
107+ params : { formatters : [ Formatters . complexObject , Formatters . checkmark ] } ,
104108 filter : {
105109 // 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
106110 // enableRenderHtml: true,
107111 // collection: [{ value: '', label: '' }, { value: true, label: 'True', labelPrefix: `<i class="fa fa-check"></i> ` }, { value: false, label: 'False' }],
108112
109- collection : [ { value : '' , label : '' } , { value : true , label : 'True' } , { value : false , label : 'False' } ] ,
113+ collection : [ { isEffort : '' , label : '' } , { isEffort : true , label : 'True' } , { isEffort : false , label : 'False' } ] ,
114+ customStructure : {
115+ value : 'isEffort' ,
116+ label : 'label'
117+ } ,
118+ isComplexObject : true ,
110119 model : Filters . singleSelect ,
111120
112121 // we could add certain option(s) to the "multiple-select" plugin
@@ -162,6 +171,7 @@ export class GridClientSideComponent implements OnInit {
162171 const randomPercent = randomBetween ( 0 , 100 ) ;
163172 const randomHour = randomBetween ( 10 , 23 ) ;
164173 const randomTime = randomBetween ( 10 , 59 ) ;
174+ const randomIsEffort = ( i % 3 === 0 ) ;
165175
166176 tempDataset . push ( {
167177 id : i ,
@@ -173,7 +183,10 @@ export class GridClientSideComponent implements OnInit {
173183 start : ( i % 4 ) ? null : new Date ( randomYear , randomMonth , randomDay ) , // provide a Date format
174184 usDateShort : `${ randomMonth } /${ randomDay } /${ randomYearShort } ` , // provide a date US Short in the dataset
175185 utcDate : `${ randomYear } -${ randomMonthStr } -${ randomDay } T${ randomHour } :${ randomTime } :${ randomTime } Z` ,
176- effortDriven : ( i % 3 === 0 )
186+ effortDriven : {
187+ isEffort : randomIsEffort ,
188+ label : randomIsEffort ? 'Effort' : 'NoEffort' ,
189+ }
177190 } ) ;
178191 }
179192
0 commit comments