Sorting issue when having html contents inside TD
Sorting issue when having html contents inside TD
Hi,
I'm having numeric content wrapped with Html and placed inside the TD.i want to sort column asc or desc.Since it is wrapped with html, i've used Numeric HTML type detection plugin and sorting plugin then initialized aoColumns
with sType:"num-html" but still i can't resolve this issue.
Any Help?
Here is the debug data for my table http://debug.datatables.net/eyofop
I'm having numeric content wrapped with Html and placed inside the TD.i want to sort column asc or desc.Since it is wrapped with html, i've used Numeric HTML type detection plugin and sorting plugin then initialized aoColumns
with sType:"num-html" but still i can't resolve this issue.
Any Help?
Here is the debug data for my table http://debug.datatables.net/eyofop
This discussion has been closed.
Replies
If it doesn't work, please link to a test case.
Allan
Tried with dataTables 1.10 but still the same.
here is the link to JsFiddle
http://jsfiddle.net/68vhp/1/
Fullscreen result: http://jsfiddle.net/68vhp/1/embedded/result/
Thanks,
Gowrish.
Allan
No,i think it's still not sorted correctly.
after sorting AS2000 column descending the values should be
61.0
27.0
23.5
23.40
15.0
but it's getting sorted as
27.0
23.5
23.40
61.0
15.0
Thanks,
Gowrish.
Allan
Gowrish.
Yes. Screenshot from Chrome using the fiddle I linked to: http://datatables.net/dev/gowrish.png
Allan
i've tested in another machine running with windows xp,Yes it works correctly as like your screen shot.but it's not working correctly in my windows7 machine..
here is the screen shot of my machine https://drive.google.com/file/d/0B3IRPs7dec7zdEFiaGZKTDlndzQ/edit?usp=sharing
It seems to be a browser issue. In Windows XP machine, version 31.X of chrome used when i updated to version 34.X it produce the same issue.
Gowrish.
I would need a way to be able to reproduce the error to be able to fix it.
Allan
Allan
Table was constructed in this way http://stackoverflow.com/questions/23126952/column-sorting-issue-in-datatables (posted by my friend)
this way of constructing causing issue?
Gowrish.
Allan
I tried the same fiddle in IE10 and can't determine anything cause it crashes with a Webpage Error "Line: 1513 Error: Access is denied."
Allan
Thanks for your continued support.i think the issue appears to be happen in firefox version 28.0 as well.
Gowrish.
This might be the Firefox bug that they "fixed": https://bugzilla.mozilla.org/show_bug.cgi?id=392511 .
I think your fix is going to be to not use entities in your attributes. I don't really see how DataTables can workaround that.
Allan
Allan
Allan
Because we how have extra `<` and `>` characters in the string, this falls apart.
I think the solution here is that we need a plug-in sorting function that will cope with this type of nested HTML. I could put it into DataTables core and there are two options:
1. Use the browser to do it - i.e. write the innerHTML into a node and then read it back using `textContent`
2. Write a parser.
Option 1 is _horribly_ slow. Fine for a couple of strings, but if you have a large table and need to do it for every cell. So not an option. Option 2 would require a significant amount of code, and I'm already past the size I wanted v1.10 to be.
So I think that the core will stay as it is, and we need a plug-in for anyone that does want to have nested HTML in attributes.
Allan
Allan
Can u give me a example of how to use [data-] attribute? this one seems a quick fix.
Thanks.