Sets or retrieves the data format converter for the grid column headers (header format).
Format converters are used to perform client-side data transformations, for example, encode html control characters or apply particular date or number formats.
var value = obj.getHeaderFormat();
obj.setHeaderFormat(value);
obj.onHeaderFormatChanging = function(value){...};
obj.onHeaderFormatChanged = function(value){...};
obj.onHeaderFormatError = function(value){...};
Encoding html control characters (<
, >
, "
, &
).
obj.setHeaderData("<header text>", 0);
obj.setHeaderFormat(new AW.Formats.String, 0);
obj.setHeaderText(function(i){
var data = this.getHeaderData(i);
var format = this.getHeaderFormat(i);
return format ? format.dataToText(data) : data;
});
Applying number format
var number = new AW.Formats.Number;
number.setTextFormat("$ #,###.##");
obj.setHeaderData("1234567.890", 0);
obj.setHeaderFormat(number, 0);
obj.setHeaderText(function(i){
var data = this.getHeaderData(i);
var format = this.getHeaderFormat(i);
return format ? format.dataToText(data) : data;
});
To activate the data/text transformations set the header text property to the converter function, like in example above.
Overview: using format converters
Grid templates: header
Header model: text, image, tooltip, link, value, data
Format properties: cell, selector, footer, top, bottom