PDA

View Full Version : Show status text instead of id



GridGridGrid
17 Jan 2013, 6:59 AM
I want to show a status title in a list instead of its id. The status texts are in a local store.

What do i have to do so that the status column shows the status description?



var columns = [{
header: 'Bestellnummer',
dataIndex: 'ordernumber',
flex: 1
},
{
header: '{s name=grid/column_date}Datum{/s}',
dataIndex: 'date',
flex: 1,
xtype: 'datecolumn',
renderer: me.renderDate
},
{
header: '{s name=grid/column_statuschange}Letzte Statusänderung{/s}',
dataIndex: 'lastchange',
flex: 1
},
{
header: '{s name=grid/column_name}Name{/s}',
dataIndex: 'fullname',
flex: 1
},
{
header: '{s name=grid/column_status}Status{/s}',
dataIndex: 'status',
flex:1
}
];




var statusStore = Ext.create('Ext.data.Store', {
fields: ['value', 'description'],
data: [
{ value: 0, description: 'Demostatus 1' },
{ value: 1, description: 'Demostatus 2' },
{ value: 2, description: 'Demostatus 3' },
{ value: 3, description: 'Demostatus 4' },
{ value: 4, description: 'Demostatus 5' }
]
});

existdissolve
17 Jan 2013, 10:59 AM
Check out the "renderer" config for columns: http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.column.Column-cfg-renderer

You could easily take the value of the cell, find its matching record in your local store, and then return the matched record's desired value.