PDA

View Full Version : [CLOSED][3.0RC1.1] defaultsortable not works



galdaka
7 May 2009, 12:27 PM
Hi,

column model config "defaultsortable" config option not works for me. If I put "sortable: true" in each column works fine.

Greetings,

evant
7 May 2009, 5:18 PM
This works correctly, change the array grid example:



var grid = new Ext.grid.GridPanel({
store: store,
colModel: new Ext.grid.ColumnModel({
columns: [
{id:'company',header: "Company", width: 160, dataIndex: 'company'},
{header: "Price", width: 75, renderer: 'usMoney', dataIndex: 'price'},
{header: "Change", width: 75, renderer: change, dataIndex: 'change'},
{header: "% Change", width: 75, renderer: pctChange, dataIndex: 'pctChange'},
{header: "Last Updated", width: 85, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
],
defaultSortable: true
}),
stripeRows: true,
autoExpandColumn: 'company',
height:350,
width:600,
title:'Array Grid'
});


Closing this off.

galdaka
7 May 2009, 11:45 PM
Hi thanks,

This code works:



cm = new Ext.grid.ColumnModel({
columns: [
expander,
sm,
{header: 'Código', dataIndex: 'codProyecto', align: 'center', renderer: function(data){return unescape(data)}},
{header: 'Creador', dataIndex: 'creadorProyecto', renderer: function(data){return unescape(data)}},
{header: 'Cliente', dataIndex: 'cliente', renderer: function(data){return unescape(data)}},
{header: 'Descripción', dataIndex: 'descripcion', renderer: function(data){return unescape(data)}},
{header: 'F. Inicio', dataIndex: 'fecInicioProyecto', renderer: function(data){return unescape(data)}},
{header: 'Duración', dataIndex: 'duracion', renderer: function(data){return unescape(data)}},
{header: 'Situación', dataIndex: 'situacion', renderer: function(data){return unescape(data)}},
{header: 'Versión', dataIndex: 'versionActualProyecto', renderer: function(data){return unescape(data)}},
{header: 'Número', dataIndex: 'numeroProyecto', renderer: function(data){return unescape(data)}}
],
defaultSortable: true
});


But this don´t work:



cm = new Ext.grid.ColumnModel([
expander,
sm,
{header: 'Código', dataIndex: 'codProyecto', align: 'center', renderer: function(data){return unescape(data)}},
{header: 'Creador', dataIndex: 'creadorProyecto', renderer: function(data){return unescape(data)}},
{header: 'Cliente', dataIndex: 'cliente', renderer: function(data){return unescape(data)}},
{header: 'Descripción', dataIndex: 'descripcion', renderer: function(data){return unescape(data)}},
{header: 'F. Inicio', dataIndex: 'fecInicioProyecto', renderer: function(data){return unescape(data)}},
{header: 'Duración', dataIndex: 'duracion', renderer: function(data){return unescape(data)}},
{header: 'Situación', dataIndex: 'situacion', renderer: function(data){return unescape(data)}},
{header: 'Versión', dataIndex: 'versionActualProyecto', renderer: function(data){return unescape(data)}},
{header: 'Número', dataIndex: 'numeroProyecto', renderer: function(data){return unescape(data)}}
]);
cm.defaultSortable = true;


Greetings,

evant
7 May 2009, 11:57 PM
Correct, because in the constructor of the column model the defaults are set. This isn't a bug, it's intentional, though it should be listed as a breaking change.

galdaka
8 May 2009, 12:39 AM
OK thanks!!

mjlecomte
21 Jul 2009, 8:34 AM
FYI the demo example in the SDK was not updated reflecting this change, see this report:
http://extjs.com/forum/showthread.php?t=75144