@@ -97,16 +97,28 @@ 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+ {
101+ id : 'effort-driven' , name : 'Effort Driven' , field : 'effortDriven.isEffort' , minWidth : 85 , maxWidth : 85 ,
101102 type : FieldType . boolean ,
102103 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
103111 filterable : true ,
104112 filter : {
105113 // 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
106114 // enableRenderHtml: true,
107115 // collection: [{ value: '', label: '' }, { value: true, label: 'True', labelPrefix: `<i class="fa fa-check"></i> ` }, { value: false, label: 'False' }],
108116
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+ } ,
110122 model : Filters . singleSelect ,
111123
112124 // we could add certain option(s) to the "multiple-select" plugin
@@ -162,6 +174,7 @@ export class GridClientSideComponent implements OnInit {
162174 const randomPercent = randomBetween ( 0 , 100 ) ;
163175 const randomHour = randomBetween ( 10 , 23 ) ;
164176 const randomTime = randomBetween ( 10 , 59 ) ;
177+ const randomIsEffort = ( i % 3 === 0 ) ;
165178
166179 tempDataset . push ( {
167180 id : i ,
@@ -173,7 +186,10 @@ export class GridClientSideComponent implements OnInit {
173186 start : ( i % 4 ) ? null : new Date ( randomYear , randomMonth , randomDay ) , // provide a Date format
174187 usDateShort : `${ randomMonth } /${ randomDay } /${ randomYearShort } ` , // provide a date US Short in the dataset
175188 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+ }
177193 } ) ;
178194 }
179195
0 commit comments