Sets or retrieves the data format converter for the top-left corner of the grid (top selector 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.getTopFormat();
obj.setTopFormat(value);
obj.onTopFormatChanging = function(value){...};
obj.onTopFormatChanged = function(value){...};
obj.onTopFormatError = function(value){...};
Encoding html control characters (<
, >
, "
, &
).
obj.setTopData("<top text>");
obj.setTopFormat(new AW.Formats.String);
obj.setTopText(function(i){
var data = this.getTopData(i);
var format = this.getTopFormat(i);
return format ? format.dataToText(data) : data;
});
Applying number format
var number = new AW.Formats.Number;
number.setTextFormat("$ #,###.##");
obj.setTopData("1234567.890");
obj.setTopFormat(number);
obj.setTopText(function(i){
var data = this.getTopData(i);
var format = this.getTopFormat(i);
return format ? format.dataToText(data) : data;
});
To activate the data/text transformations set the top text property to the converter function, like in example above.
Overview: using format converters
Grid templates: top selector
Top model: text, image, tooltip, link, value, data
Format properties: cell, selector, header, footer, bottom