Updating cell data with "string" allows HTML formatting

Updating cell data with "string" allows HTML formatting

paultechguypaultechguy Posts: 8Questions: 5Answers: 0

I have a table with a Name column. It is defined with a columndef of "type: string". If the database has a value for Name like "<em>Fred</em> datatables correctly shows it as "<em>Fred</em> since it is a string, not "type: html". But, if my modal edit dialog does a table.cell(myRow, myCol).data(updatedName), then the table redraw will show Fred in italics.

This seems like a bug...the redraw of the table shows the formatted html, rather than showing it as a "type: string" with the html tags showing.

Your thoughts?

Answers

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    By default DataTables will not encode HTML entities - there is a built in renderer that can be used to do that if you need though.

    So it sounds like your database might have the entities encoded it in, or perhaps something reading it from the db is encoding them. But either way, the data being fed in initially is different from that being updated with cell().data().

    Allan

This discussion has been closed.