DataTables not working if the table content has special characters.
DataTables not working if the table content has special characters.
jQuery_user
Posts: 27Questions: 0Answers: 0
Hello,
I am working on table row_details.
DataTables is not working whenever the content has special characters like , " # etc..
How to fix this?
I tried to replace these special charaters using \ by writing the following code:
[code]
function escapeString(s) {
var eChars = ["\\", "'", '"', ',', '#', '-'];
var lasti = eChars.length;
for (var i = 0; i < lasti; i++) {
var sArray = s.split(eChars[i]);
var lastj = sArray.length;
s = '';
for (var j = 0; j < lastj; j++) {
s += sArray[j] + '\\' + eChars[i];
}
}
var last = s.length - 2*eChars.length;
return s.substring(0, last);
}[/code]
Still I have same problem...
Does anybody have a solution for this...
Thanks
I am working on table row_details.
DataTables is not working whenever the content has special characters like , " # etc..
How to fix this?
I tried to replace these special charaters using \ by writing the following code:
[code]
function escapeString(s) {
var eChars = ["\\", "'", '"', ',', '#', '-'];
var lasti = eChars.length;
for (var i = 0; i < lasti; i++) {
var sArray = s.split(eChars[i]);
var lastj = sArray.length;
s = '';
for (var j = 0; j < lastj; j++) {
s += sArray[j] + '\\' + eChars[i];
}
}
var last = s.length - 2*eChars.length;
return s.substring(0, last);
}[/code]
Still I have same problem...
Does anybody have a solution for this...
Thanks
This discussion has been closed.
Replies