Development

Changeset 12050

You must first sign up to be able to contribute.

Changeset 12050

Show
Ignore:
Timestamp:
10/07/08 19:23:03 (2 months ago)
Author:
KRavEN
Message:

Fixes to properly update the gridView sortState for foreign columns

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfExtjsThemePlugin/trunk/web/js/Ext.grid.ColumnModel.override.js

    r12046 r12050  
    33Ext.grid.ColumnModel.override({ 
    44 
    5   //adds in proper disabling of the header menu when enableHdMenu is set to false 
     5  // adds in proper disabling of the header menu when enableHdMenu is set to 
     6  // false 
    67  isMenuDisabled : function(col) 
    78  { 
     
    6061          { 
    6162            c.editor = Ext.ComponentMgr.create(c.editor, 'textfield'); // get 
    62                                                                         // instance 
    63                                                                         // from 
    64                                                                         // xtype 
    65                                                                         // config, 
    66                                                                         // default 
    67                                                                         // to 
    68                                                                         // textfield 
     63            // instance 
     64            // from 
     65            // xtype 
     66            // config, 
     67            // default 
     68            // to 
     69            // textfield 
    6970          } 
    7071          // create gridEditor 
     
    9697  }, 
    9798 
    98   getSortField : function(col){ 
    99     return (this.config[col].sortField)?this.config[col].sortField:this.config[col].dataIndex; 
     99  getSortField : function(col) 
     100  { 
     101    return (this.config[col].sortField) ? this.config[col].sortField : this.config[col].dataIndex; 
     102  }, 
     103 
     104  /** 
     105   * Finds the index of the first matching column for the given dataIndex. 
     106   * 
     107   * @param {String} 
     108   *          col The dataIndex to find 
     109   * @return {Number} The column index, or -1 if no match was found 
     110   */ 
     111  findSortIndex : function(dataIndex) 
     112  { 
     113    var c = this.config; 
     114 
     115    for (var i = 0, len = c.length; i < len; i++) 
     116    { 
     117      var index = (c[i].sortField) ? c[i].sortField : c[i].dataIndex; 
     118      if (index == dataIndex) 
     119      { 
     120        return i; 
     121      } 
     122    } 
     123    return -1; 
    100124  } 
    101125}); 
  • plugins/sfExtjsThemePlugin/trunk/web/js/Ext.grid.GridView.override.js

    r12049 r12050  
    9292 
    9393  // private 
     94  updateHeaderSortState : function() 
     95  { 
     96    var state = this.ds.getSortState(); 
     97    if (!state) 
     98    { 
     99      return; 
     100    } 
     101    if (!this.sortState || (this.sortState.field != state.field || this.sortState.direction != state.direction)) 
     102    { 
     103      this.grid.fireEvent('sortchange', this.grid, state); 
     104    } 
     105    this.sortState = state; 
     106    var sortColumn = this.cm.findSortIndex(state.field); 
     107    if (sortColumn != -1) 
     108    { 
     109      var sortDir = state.direction; 
     110      this.updateSortIcon(sortColumn, sortDir); 
     111    } 
     112  }, 
     113 
     114  // private 
    94115  onHeaderClick : function(g, index) 
    95116  {