4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-grid-property-HeaderContainer'>/**
19 </span> * @class Ext.grid.property.HeaderContainer
20 * @extends Ext.grid.header.Container
21 * A custom HeaderContainer for the {@link Ext.grid.property.Grid}. Generally it should not need to be used directly.
23 Ext.define('Ext.grid.property.HeaderContainer', {
25 extend: 'Ext.grid.header.Container',
27 alternateClassName: 'Ext.grid.PropertyColumnModel',
31 // private - strings used for locale support
39 nameColumnCls: Ext.baseCSSPrefix + 'grid-property-name',
41 <span id='Ext-grid-property-HeaderContainer-method-constructor'> /**
42 </span> * Creates new HeaderContainer.
43 * @param {Ext.grid.property.Grid} grid The grid this store will be bound to
44 * @param {Object} source The source data config object
46 constructor : function(grid, store) {
54 width: grid.nameColumnWidth || me.nameWidth,
56 dataIndex: grid.nameField,
57 renderer: Ext.Function.bind(me.renderProp, me),
58 itemId: grid.nameField,
60 tdCls: me.nameColumnCls
63 renderer: Ext.Function.bind(me.renderCell, me),
64 getEditor: Ext.Function.bind(me.getCellEditor, me),
67 dataIndex: grid.valueField,
68 itemId: grid.valueField,
74 getCellEditor: function(record){
75 return this.grid.getCellEditor(record, this);
79 // Render a property name cell
80 renderProp : function(v) {
81 return this.getPropertyName(v);
85 // Render a property value cell
86 renderCell : function(val, meta, rec) {
88 renderer = me.grid.customRenderers[rec.get(me.grid.nameField)],
92 return renderer.apply(me, arguments);
94 if (Ext.isDate(val)) {
95 result = me.renderDate(val);
96 } else if (Ext.isBoolean(val)) {
97 result = me.renderBool(val);
99 return Ext.util.Format.htmlEncode(result);
103 renderDate : Ext.util.Format.date,
106 renderBool : function(bVal) {
107 return this[bVal ? 'trueText' : 'falseText'];
111 // Renders custom property names instead of raw names if defined in the Grid
112 getPropertyName : function(name) {
113 var pn = this.grid.propertyNames;
114 return pn && pn[name] ? pn[name] : name;