webismymind / editablegrid

EditableGrid is an open source Javascript library aimed at turning HTML tables into advanced editable components. It focuses on simplicity: only a few lines of code are required to get your first table up and running.
http://www.editablegrid.net
Other
796 stars 271 forks source link

HTML entities problem #11

Closed d3s4x closed 11 years ago

d3s4x commented 13 years ago

When I attach EditableGrid to existing HTML table and in some cell there are & amp; entities, Grid replaces ampersand with & so it becomes & amp;amp; and in browser I see & amp; instead of &.

Second problem is that, when i start to edit some cell where are some &, in input i get & and it is annoying.

First problem I temporarily solved by creating cellRenrerer where i do cell.innerHTML = value.replace('& amp;amp;', '& amp;');

But the second one is still remains.

Please fix it.

webismymind commented 13 years ago

Sorry I had never seen your issue (I expected to receive a mail for new issues!) I'll take care of this ASAP.

ginjo commented 13 years ago

I too am having the same problem. My data strings have lots of ampersands, and they all show as "&" when I attach editablegrid to my html tables. Would love to see a fix or a suggestion on how to disable this. Thanks.

webismymind commented 13 years ago

I think this problem should be fixed with the very last version of Git's master branch, cf. commit of June 13th "Rendering does not escape special HTML characters when the column type is 'html' ".

So you should update your local copy and declare your column of type "html" instead of "string" and it should be OK. I will test this ASAP and release a new official version soon (containing several small improvements like this).

ginjo commented 13 years ago

Looking forward to it... and just to clarify (github botched my text above, making it difficult to explain these kinds of problems), I want all characters that were entered into the database to show as they were entered and not translated or encoded.

ginjo commented 13 years ago

I think my problem is the opposite of the problem introduced in this thread. I'm using "string" data types, and special characters are being escaped. I do not want ampersands, or any other characters escaped, when I use the string data type.

I brute-forced a solution by modifying the last commit to bypass escaping special characters:

This works great for the grid display, however special characters are still escaped in edit mode for each cell. I've scoured the code, but I can't find where this is happening.