How set a dropdown ?

How set a dropdown ?

jpavanjpavan Posts: 38Questions: 12Answers: 0

I want to set a dropdown in DataTables "columns" so if the received data is 1 it show A and if it is 2, B for example.
In dataTable.Editor if I set:
fields: [
{
"label": "Permiso:",
"name": "usu_codper",
"fieldInfo": "Permiso de acceso a la tabla",
"type": "select",
"options": [
{label: "Lectura", value: 1},
{label: "Escritura", value: 2}
]
},
],
it work.
But how do I do if I'm not in editor?.

Thanks.

Replies

  • jpavanjpavan Posts: 38Questions: 12Answers: 0

    I see how to do this:

    "columns": [
    { "data": "usu_codper" ,
    render: function (val, type, row) {
    if (val == 1) {
    $texto = 'Lectura';
    } else {
    $texto = 'Escritura';
    }
    return $texto ;
    }
    },

  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin

    Just to check - are you happy that this is resolved now?

    Allan

  • jpavanjpavan Posts: 38Questions: 12Answers: 0

    Yes Alan; please close it.
    And congratulations for your great work.

    Best regards,
    jorge.

This discussion has been closed.