Jun 25, 2008, 6:37 PM
2008-06-25 [Revision #73, Version 0.6.0]
- Changed GridPanel Renderer property to use new Renderer type.
The following example demonstrates setting a custom Handler to check if a boolean value is 'true', then return 'Yes' or 'No'. The Handler is automatically wrapped in a function(){} template and the Column arguments are passed into the function.
Example
// arguments<ext:Column Header="Indoor?" DataIndex="Indoor" Sortable="true"> <Renderer Handler="return (value) ? 'Yes':'No';" /> </ext:Column>
// "value", "metadata", "record", "rowIndex", "colIndex", "store"
The following example demonstrates setting a custom function. The function is rendered as a raw value and no formatting is applied.
Example
The following example demonstrates setting one of the Renderer helper Formats. The Renderer helper Format are a list of pre-defined list of functions which wrap common formatting functionality.<ext:Column Header="Availability" DataIndex="Availability"> <Renderer Fn="Ext.util.Format.dateRenderer('Y-m-d')" /> </ext:Column>
Example
Other Format types include:<ext:Column Header="Price" DataIndex="Price" Sortable="true"> <Renderer Format="UsMoney" /> </ext:Column>
None,
Capitalize,
Date,
DateRenderer,
DefaultValue,
Ellipsis,
FileSize,
HtmlDecode,
LowerCase,
StripScripts,
StripTags,
Substr,
Trim,
Undef,
Uppercase,
UsMoney
The following example demonstrates setting the Ellipsis Format and passing an extra argument to trim the description at 50 characters.
Example
<ext:Column Header="Description" DataIndex="description" Width="150"> <Renderer Format="Ellipsis" FormatArgs="50" /> </ext:Column>