X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/530ef4b6c5b943cfa68b779d11cf7de29aa878bf..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/docs/source/HeaderContainer.html diff --git a/docs/source/HeaderContainer.html b/docs/source/HeaderContainer.html new file mode 100644 index 00000000..f6713d43 --- /dev/null +++ b/docs/source/HeaderContainer.html @@ -0,0 +1,92 @@ +Sencha Documentation Project
/**
+ * @class Ext.grid.property.HeaderContainer
+ * @extends Ext.grid.header.Container
+ * A custom HeaderContainer for the {@link Ext.grid.property.Grid}.  Generally it should not need to be used directly.
+ * @constructor
+ * @param {Ext.grid.property.Grid} grid The grid this store will be bound to
+ * @param {Object} source The source data config object
+ */
+Ext.define('Ext.grid.property.HeaderContainer', {
+
+    extend: 'Ext.grid.header.Container',
+
+    alternateClassName: 'Ext.grid.PropertyColumnModel',
+
+    // private - strings used for locale support
+    nameText : 'Name',
+    valueText : 'Value',
+    dateFormat : 'm/j/Y',
+    trueText: 'true',
+    falseText: 'false',
+
+    // private
+    nameColumnCls: Ext.baseCSSPrefix + 'grid-property-name',
+    
+    constructor : function(grid, store) {
+
+        this.grid = grid;
+        this.store = store;
+        this.callParent([{
+            items: [{
+                header: this.nameText,
+                width: 115,
+                sortable: true,
+                dataIndex: grid.nameField,
+                renderer: Ext.Function.bind(this.renderProp, this),
+                itemId: grid.nameField,
+                menuDisabled :true,
+                tdCls: this.nameColumnCls
+            }, {
+                header: this.valueText,
+                renderer: Ext.Function.bind(this.renderCell, this),
+                getEditor: function(record) {
+                    return grid.getCellEditor(record, this);
+                },
+                flex: 1,
+                fixed: true,
+                dataIndex: grid.valueField,
+                itemId: grid.valueField,
+                menuDisabled: true
+            }]
+        }]);
+    },
+
+    // private
+    // Render a property name cell
+    renderProp : function(v) {
+        return this.getPropertyName(v);
+    },
+
+    // private
+    // Render a property value cell
+    renderCell : function(val, meta, rec) {
+        var me = this,
+            renderer = this.grid.customRenderers[rec.get(me.grid.nameField)],
+            result = val;
+
+        if (renderer) {
+            return renderer.apply(this, arguments);
+        }
+        if (Ext.isDate(val)) {
+            result = this.renderDate(val);
+        } else if (Ext.isBoolean(val)) {
+            result = this.renderBool(val);
+        }
+        return Ext.util.Format.htmlEncode(result);
+    },
+
+    // private
+    renderDate : Ext.util.Format.date,
+
+    // private
+    renderBool : function(bVal) {
+        return this[bVal ? 'trueText' : 'falseText'];
+    },
+
+    // private
+    // Renders custom property names instead of raw names if defined in the Grid
+    getPropertyName : function(name) {
+        var pn = this.grid.propertyNames;
+        return pn && pn[name] ? pn[name] : name;
+    }
+});
\ No newline at end of file