Results 1 to 2 of 2

Thread: [DEFER] Custom grid column with width and/or sortable

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default [DEFER] Custom grid column with width and/or sortable

    From this thread:
    When specifying a column as an xtype it is not possible to define 'width' and/or 'sortable' in the column class.

    Example:
    Code:
    MyColumn = Ext.extend(Ext.grid.Column, {
        constructor: function(config) {
            MyColumn.superclass.constructor.call(this, Ext.apply({
                header: 'ID',
                width: 10,
                sortable: true
            }, config));
        }
    });
    Ext.grid.Column.types['mycolumn'] = MyColumn;
    var colModel = new Ext.grid.ColumnModel({
      columns: [
        {xtype: 'mycolumn'}
      ]
    });
    The resulting column will have width:100 (=defaultWidth) and sortable:false (=defaultSortable).

    We could change:
    Code:
    Ext.override(Ext.grid.ColumnModel, {
        setConfig : function(config, initial) {
            var i, c, len;
            if (!initial) {
                delete this.totalWidth;
                for (i = 0, len = this.config.length; i < len; i++) {
                    c = this.config[i];
                    if (c.setEditor) {
                        c.setEditor(null);
                    }
                }
            }
            this.defaults = Ext.apply({
                width: this.defaultWidth,
                sortable: this.defaultSortable
            }, this.defaults);
            this.config = config;
            this.lookup = {};
            for (i = 0, len = config.length; i < len; i++) {
                // c = Ext.applyIf(config[i], this.defaults);
                if (Ext.isEmpty(c.id)) {
                    c.id = i;
                }
                if (!c.isColumn) {
                    var Cls = Ext.grid.Column.types[c.xtype || 'gridcolumn'];
                    c = new Cls(c);
                    config[i] = c;
                }
                c = Ext.applyIf(config[i], this.defaults);
                this.lookup[c.id] = c;
            }
            if (!initial) {
                this.fireEvent('configchange', this);
            }
        }
    });
    But that would have impact on the config options passed to the column constructor, which wouldn't be backward compatible.

  2. #2
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661

    Default

    Do to the impact this would have on existing applications we cannot add this to the 3.x branch. This should be possible with the new column modes in 4.x.

Similar Threads

  1. Replies: 8
    Last Post: 4 Jun 2010, 10:05 AM
  2. Set a column NOT sortable, yet retain column menu?
    By Troy Wolf in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 25 Oct 2007, 8:38 AM
  3. How to set Grid column width according to the title text width
    By maya in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 30 Jul 2007, 4:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •