Converts the data coming from the datasource to the display text. This method is used internally by the grid control to produce the cell text from the cell data property.
nullvar text = format.dataToText(data);
data (string) - incoming data string (from the datasource)
text string formatted for display
// create and configure date converter
var date = new AW.Formats.Date;
date.setDataFormat("ISO8601");
date.setTextFormat("mmm d, yyyy");
var data = "2004-05-18T00:00:00+01:00";
var text = date.dataToText(data); // May 18, 2004
The dataToText()
method is implemented in the base class as a sequence of dataToValue()
and valueToText()
calls -
obj.dataToText = function(data){
var value = this.dataToValue(data);
return this.valueToText(value);
};
Derived classes (AW.Formats.Number, AW.Formats.Date) overwrite dataToText()
and valueToText()
methods according to the pattern specified in the setTextFormat()
call.
If the data cannot be parsed - the method returns error text which can be configured with setErrorText()
call.
AW.System.Format methods: dataToValue, valueToText, setErrorText
Formatting classes: number, string, html, date
Grid cell properties: text, value, data, format