Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Jun 2007
    Posts
    31
    Vote Rating
    0
    pianoroy is on a distinguished road

      0  

    Default [FIXED-1365] GridPanel::applyState may call ColumnModel::setState incorrectly (3.3)

    [FIXED-1365] GridPanel::applyState may call ColumnModel::setState incorrectly (3.3)


    Ext version tested:
    • Ext 3.3.0 (Bug exists here. The setState function in Ext.grid.ColumnModel was introduced in Ext 3.3.0)

    Browser versions tested against:
    • IE9
    • FF3 (firebug 1.5.4 installed)
    • Chrome 7

    Operating System:
    • Windows 7 Enterprise

    Description:
    • The setState function of Ext.grid.ColumnModel (which is new to 3.3) can only accept an integer (or a string containing an integer) as the first argument, since the this.config object is an array. See the second line:
      Code:
      setState : function(col, state) {
          state = Ext.applyIf(state, this.defaults);
          Ext.apply(this.config[col], state);
      }
      The problem is that Ext.grid.GridPanel::applyState calls this function and passes a string value as the first argument (in red below) if the id (string) property of a column was specified in the grid's column model:
      Code:
      applyState : function(state){
          var cm = this.colModel,
              cs = state.columns,
              store = this.store,
              s,
              c,
              oldIndex;
      
          if(cs){
              for(var i = 0, len = cs.length; i < len; i++){
                  s = cs[i];
                  c = cm.getColumnById(s.id);
                  if(c){
                      cm.setState(s.id, {
                          hidden: s.hidden,
                          width: s.width    
                      });
                      oldIndex = cm.getIndexById(s.id);
                      if(oldIndex != i){
                          cm.moveColumn(oldIndex, i);
                      }
                  }
              }
          }
      
          // . . .
      }

    Steps to reproduce (and test case):
    Actually this problem can be reproduced on an Ext 3.3 sample page.
    • Go to this URL : http://dev.sencha.com/deploy/dev/exa...rray-grid.html
    • Hide the Company column
    • Reload. The company column didn't hide. This is because the column model provides an id (string) for the company column.
    • Try on any other column - it will work elsewhere. This is because the other columns don't provide an id (string).

    Possible fix:
    • Change the beginning of the GridPanel::applyState function to the following (changes in red):
      Code:
      applyState: function(state){
          var cm = this.colModel,
              cs = state.columns,
              store = this.store,
              s,
              c,
              colIndex;
      
          if(cs){
              for(var i = 0, len = cs.length; i < len; i++){
                  s = cs[i];
                  c = cm.getColumnById(s.id);
                  if(c) {
                      colIndex = cm.getIndexById(s.id); //moved to beginning of block
      
                      cm.setState(colIndex, {
                          hidden: s.hidden,
                          width: s.width    
                      });
                          
                      if(colIndex != i){
                          cm.moveColumn(colIndex, i);
                      }
                  }
              }
          }
      
          // . . .
      }

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,115
    Vote Rating
    507
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    This has been fixed in SVN, thanks for the report.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Mar 2010
    Posts
    41
    Vote Rating
    0
    karnak is on a distinguished road

      0  

    Default


    Evan,

    Has this been fixed in 3.3.1 ?

    Thanks!

Similar Threads

  1. Replies: 5
    Last Post: 7 Jun 2012, 12:46 AM
  2. Replies: 0
    Last Post: 14 Sep 2010, 10:25 AM
  3. GridPanel with forceFit sizes columns incorrectly
    By oboyklubben in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 17 Sep 2008, 10:53 PM
  4. GridPanel rendered incorrectly in a TabPanel
    By puzzles in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 12 Oct 2007, 9:52 AM

Thread Participants: 2

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar