render the editor field using display as the field type

render the editor field using display as the field type

crush123crush123 Posts: 417Questions: 126Answers: 18

I want to display a currency value in my editor instance for information only, but would like to render it so it shows as it does in the datatable.

eg, If the value is 2, it is rendered in the table to £2.00 using render: $.fn.dataTable.render.number( ',', '.', 2, '£' )

Is it possible to do the same within editor ?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Editor doesn't have a rendering option for data, so no, not directly since it is assumed it will always be editing the raw data.

    However, you might want to take a look at the masked input type plug-in which might suit your needs.

    Allan

  • crush123crush123 Posts: 417Questions: 126Answers: 18

    Thanks Allan,

    That looks promising, but am I able to have the data of type 'masked' AND 'display' ?

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Sorry, I didn't realise you want just display information only. No, you would need a custom plug-in for that which does the formatting (or perhaps adjust the display plug-in to be able to provide it with a formatting function would be best).

    Allan

  • crush123crush123 Posts: 417Questions: 126Answers: 18

    Okay, will have a play with it

This discussion has been closed.