extracting data from a table cell for sorting
extracting data from a table cell for sorting
Is it possible to extract data from a table cell for sorting? I have problems sorting ?,, characters so i would like to do something like:
textExtraction: function(node) {
// extract data from markup and return it
var s= node.innerHTML;
s = s.replace("?", "CZ");
s = s.replace("?", "CZ");
s = s.replace("?", "DZ");
s = s.replace("", "SZ");
s = s.replace("", "ZZ");
s = s.replace("?", "cz");
s = s.replace("?", "cz");
s = s.replace("?", "dz");
s = s.replace("", "sz");
s = s.replace("", "zz");
return s;
}
textExtraction: function(node) {
// extract data from markup and return it
var s= node.innerHTML;
s = s.replace("?", "CZ");
s = s.replace("?", "CZ");
s = s.replace("?", "DZ");
s = s.replace("", "SZ");
s = s.replace("", "ZZ");
s = s.replace("?", "cz");
s = s.replace("?", "cz");
s = s.replace("?", "dz");
s = s.replace("", "sz");
s = s.replace("", "zz");
return s;
}
This discussion has been closed.
Replies
http://datatables.net/plug-ins/sorting
http://datatables.net/development/sorting
Regards,
Allan
[code]
"string-asc": function ( a, b )
{
var x = a.replace(/?/g, "CZ").toLowerCase();
x = x.replace(/?/g, "CZ").toLowerCase();
x = x.replace(/?/g, "DZ").toLowerCase();
x = x.replace(//g, "SZ").toLowerCase();
x = x.replace(//g, "ZZ").toLowerCase();
x = x.replace(/?/g, "cz").toLowerCase();
x = x.replace(/?/g, "cz").toLowerCase();
x = x.replace(/?/g, "dz").toLowerCase();
x = x.replace(//g, "sz").toLowerCase();
x = x.replace(//g, "zz").toLowerCase();
var y = b.replace(/?/g, "CZ").toLowerCase();
y = y.replace(/?/g, "CZ").toLowerCase();
y = y.replace(/?/g, "DZ").toLowerCase();
y = y.replace(//g, "SZ").toLowerCase();
y = y.replace(//g, "ZZ").toLowerCase();
y = y.replace(/?/g, "cz").toLowerCase();
y = y.replace(/?/g, "cz").toLowerCase();
y = y.replace(/?/g, "dz").toLowerCase();
y = y.replace(//g, "sz").toLowerCase();
y = y.replace(//g, "zz").toLowerCase();
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
},
"string-desc": function ( a, b )
{
var x = a.replace(/?/g, "CZ").toLowerCase();
x = x.replace(/?/g, "CZ").toLowerCase();
x = x.replace(/?/g, "DZ").toLowerCase();
x = x.replace(//g, "SZ").toLowerCase();
x = x.replace(//g, "ZZ").toLowerCase();
x = x.replace(/?/g, "cz").toLowerCase();
x = x.replace(/?/g, "cz").toLowerCase();
x = x.replace(/?/g, "dz").toLowerCase();
x = x.replace(//g, "sz").toLowerCase();
x = x.replace(//g, "zz").toLowerCase();
var y = b.replace(/?/g, "CZ").toLowerCase();
y = y.replace(/?/g, "CZ").toLowerCase();
y = y.replace(/?/g, "DZ").toLowerCase();
y = y.replace(//g, "SZ").toLowerCase();
y = y.replace(//g, "ZZ").toLowerCase();
y = y.replace(/?/g, "cz").toLowerCase();
y = y.replace(/?/g, "cz").toLowerCase();
y = y.replace(/?/g, "dz").toLowerCase();
y = y.replace(//g, "sz").toLowerCase();
y = y.replace(//g, "zz").toLowerCase();
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
},
[/code]
Thank you!
Domen
Ah I see - have a look at this thread which considers this topic: http://datatables.net/forums/comments.php?DiscussionID=1212
Regards,
Allan