2010-05-04 8 views

Respuesta

0

Puede que tenga que actualizar Ext.grid.GridView para que se muestre el cambio de columna.

grid.getView().refresh(true) // true to refresh HeadersToo 
0

En ExtJs 3.x esta pieza de código puede ayudar:

Nota: He utilizado casilla de verificación, como la primera columna. Elimina esa línea si no la necesitas.

var newColModel = new Ext.grid.ColumnModel({ 
    columns: [ 
     grid.getSelectionModel(), 
     { 
      header: 'New column 1' 
     }, { 
      header: 'New column 2' 
     } 
    ], 
    defaults: { 
     sortable: false 
    } 
}); 

grid.store.reader = new Ext.data.JsonReader({ 
    root: 'items', 
    totalProperty: 'count', 
    fields: [ 
     // Please provide new array of fields here 
    ] 
}); 

grid.reconfigure(grid.store, newColModel); 
0

La función reconfigure podría no funcionar bien con los plugins. Especialmente si tiene algo como FilterBar.

Si solo tiene que hacer esto una vez, según algunos ajustes globales que se usan puede usar initComponent y cambiar su configuración inicial. Asegúrese de que todos los cambios en la configuración antes de llamar this.callParent();

probado con ExtJS 6.2 (pero también debe trabajar para ExtJS 4 y 5)

initComponent: function() { 
    // less columns for this setting 
    if (!app.Settings.dontUseFruits()) { 
     var newColumns = []; 
     for(var i=0; i<this.columns.items.length; i++) { 
      var column = this.columns.items[i]; 
      // remove (don't add) columns for which `dataIndex` starts with "fruit" 
      if (column.dataIndex.search(/^fruit/) < 0) { 
       newColumns.push(column); 
      } 
     } 
     this.columns.items = newColumns; 
    } 

    this.callParent(); 
0

quizás tratar

store.add (nuevo record); store.commitChanges();

o store.remove() y store.commitChanges()

Cuestiones relacionadas