2009
12.31

Datagrid fans may be pleased to hear that as of version 3.4 of the SDK, the dataField property of DataGridColumn supports nested properties. This has been an oft-requested feature of the list-based classes, as evidenced by a long-standing issue in the bug-tracking system.

Looking at the framework source, the changes to DataGridColumn source code do not differ greatly from the community-contributed solutions that already existed. Some optimisations have been introduced such as the parsing of the dataField property once when the property is first set rather than every time the field is evaluated.

Performance concerns appear to be the main reason for omitting this capability from earlier versions. The feature can be expected to be sub-optimal when compared with alternatives such as a labelFunction or custom renderer. However given popular maxims on the evils of premature optimisation, and the availability of more efficient alternatives should the need arise, it seems unnecessary to discard a feature for this reason alone.

My main concern with using dataField for complex expressions is the lack of compile-time checking. A labelFunction may require more code but you’ll get more help from the compiler if the expression is incorrect. An invalid expression in a dataField property is likely to fail silently and may not be noticed until your testing phase, or perhaps even later. However, if you are generating your columns dynamically or binding to an XML data-provider, then the lack of compile-time checking may be less of an issue.

No Comment.

Add Your Comment