ExtJS - Sort column (rendered) by raw data

0

I have a grid with a column (' priority ') to which a renderer is applied to display a text according to the value it has. Being a priority column we will be working with the following values:

1 = 'baja'
2 = 'media'
3 = 'alta'
4 = 'critica'

What I want is for you to order me by the original numerical values and not by the rendered ones, since in this case the alphabetical order does not make sense.

  

This is the code of the grid :

{
    xtype: 'grid',
    itemId: 'MOTIVOS',
    store: modulo.motivos,
    columns: [
            { text: 'id', width: 68, sortable: true, dataIndex: 'id', align:'right' },
            { text: 'motivo', width: 540, sortable: true, dataIndex: 'descripcion' },
            { text: 'ambito', width: 110, sortable: true, dataIndex: 'ambito' },
            { text: 'area', width: 160, sortable: true, dataIndex: 'area', readonly: true },

            {
                text: 'prioridad', width: 100, sortable: true, dataIndex: 'prioridad',
                renderer: function (value, metadata, record) {
                    return me.modulo.getUtils().renderPrioridad(value);     //the render function
                },
                readonly: true
            },
            { text: 'numProtocolos', width: 102, sortable: true, dataIndex: 'numProto', align: 'center' }
        ]
};
  

The model of the store :

Ext.define('app.model.Motivo', {
   extend: 'Ext.data.Model',
   fields: [
       { name: 'id', type: 'int' },
       { name: 'ambito', type: 'string' },
       { name: 'area', type: 'string' },
       { name: 'subarea', type: 'string' },
       { name: 'descripcion', type: 'string' },
       { name: 'prioridad', type: 'int' },
       { name: 'numProto', type:'int'}
   ]
 });

The 'priority' column is of type int but is rendered with the strings according to its priority ( High (3) / Media (2) / Baja (1)).

In the grid I am ordered by these strings instead of the numeric values real that are behind (3,2,1) and I need you to order me by these values keeping visible the rendered words for the UX.

    
asked by AXL 01.02.2017 в 10:13
source

0 answers