I am trying to re-create the male or female icon that is displayed with the employee name in Northwind forms according to employee gender. It seems to be very complicated. Is there a description of this implementation?
Look at the Northwind Sample. Specifically Employee row, gender.cs and the employeeformatter.cs.
It's very straight forward.
@dkontod samples are there for you to not ask these questions.
Hello i am used the following code to display the icon of Gender in Grid.
@Serenity.Decorators.registerFormatter([Serenity.ISlickFormatter, Serenity.IInitializeColumn])
export class PensionersFormatter implements Slick.Formatter {
format(ctx: Slick.FormatterContext) {
var text = Q.htmlEncode(ctx.value);
if (!this.genderProperty) {
return text;
}
var gender = ctx.item[this.genderProperty];
return "<span class='" + ((gender === OnlinePVA.Modules.Default.Titles.Gender.Female) ?
'employee-symbol female' : 'employee-symbol male') +
"'>" + text + '</span>';
}
@Serenity.Decorators.option()
public genderProperty: string;
public initializeColumn(column: Slick.Column) {
column.referencedFields = column.referencedFields || [];
if (this.genderProperty)
column.referencedFields.push(this.genderProperty);
}
But it does not working.( I Reffered the Northwind Samples ).
Let me know any changes in above code.
Thank you.
Most helpful comment
Look at the Northwind Sample. Specifically Employee row, gender.cs and the employeeformatter.cs.
It's very straight forward.