.data() results are not actually raw, converting &

.data() results are not actually raw, converting &

garrgarrgarrgarr Posts: 1Questions: 1Answers: 0
edited July 2014 in Free community support

I'm trying to store a URL with query args in a hidden column. I can get the data from the row when clicked. All good.
However, the & in the URL is causing problems.

This is what I get back from data()

"http://dev.xxxx.com/wordpress/statistics?GUID=aae1bc99-03a9-c6ae-4447-5cc66fca7f66§ion=leaderboard"

This is the data (part of html):

<td class='LINK column-LINK'>http://dev.xxxx.com/wordpress/statistics?GUID=aae1bc99-03a9-c6ae-4447-5cc66fca7f66&section=leaderboard</td

You can see that "&sect" was converted to §. This is a hidden, non-rendered cell, but data() should return raw regardless.

This is on Chrome. I can encode in the HTML and then search/replace in javascript to undo that encoding, but that's quite a hack. I may have to use some method other than data(). Any thoughts?

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Agreed - the data() functions should always return the raw data. Is this data(), row().data(), column().data() or cell().data() you are having problems with?

    Can you link to a page showing the error so I can debug it please? JSFiddle, CodePen or http://live.datatables.net can be used to create a test page if you can provide a link to the page you are working on.

    Allan

This discussion has been closed.