Editor: type select displays it's value after change

Editor: type select displays it's value after change

shaheencshaheenc Posts: 2Questions: 1Answers: 0

Hi,

I am having trouble with inline editing for type="select", could you please check following link?

http://live.datatables.net/zuwodula/8/edit

*type of second column is "select", but when I change it, display value is changed to id,
it should display options label,

how can I achieve this?

one thing I can do is: track change event of select and manipulate dom, which I don't want.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,818Questions: 1Answers: 10,517 Site admin
    Answer ✓

    There are two options:

    1. Use a columns.render function to transform the value to a label. Since you have a static list of values, that might be the easiest option here (i.e. just a simple case or if statement).
    2. Include the label in the data set. That is the approach that my join examples take. That way DataTables can display the label while Editor edits the value.

    Allan

  • shaheencshaheenc Posts: 2Questions: 1Answers: 0

    yes I used columns.render option,
    I was querying if there was any builtin, because we are adding option
    as
    options: [{ label: 'To do', value: 1 }, { label: 'Done',value: 2 }]

This discussion has been closed.