How to use datatables editor with rendered columns?
How to use datatables editor with rendered columns?
Two closely-related (I think) questions:
(1)
I am using a datasource that delivers the date as a ctime. I use a renderer to change that to a nice date view in the table. But the editor still sees the ctime. If I specify the type is date (or datetime), the 'new' form input will show a datepicker, but the 'edit' form input will either show the raw ctime (date) or the default value (today, datetime). I can almost see that this could be done with renderers somehow, but I can't quite put the pieces together.
(2)
I'm having essentially the same problem with html entities in a text field. The server is encoding single quotes, double quotes and ampersands, and adding some backslashes for good measure. I think that the entityDecode operation is supposed to take care of this, but perhaps the slashes are giving it a problem? Here's an example: the first line is what the text looks like when rendered in the table, the second line is what it looks like in the text input of the edit form, and the 3rd line is the actual raw data:
Created "for real" with Jerry's data & mine.
Created \"for real\" with Jerry\'s data & mine.
Created \"for real\" with Jerry\'s data & mine.
Any thoughts on how I can these problems? --- many thanks.
(The site isn't public, I'm afraid, so I can't post a link to it, sorry.)
This question has an accepted answers - jump to answer
Answers
Hi,
Editor will always use the raw data - it can't use the rendered data at all. So the key is to have the server return the data in the format you need. If you are using the .NET libraries (I presume you are using .NET from your
DateTime
type) then you could use a formatter for that.The same also applies for the second issue. If you are formatting the code on the server-side it should also be deformatted by it before passing back to the client-side.
Allan
OK, good to know!